[TYPO3-shop] Select shipping method depending on weight

Simon J simonj at removethis!mail.dk
Thu Jul 2 22:53:34 CEST 2009


Simon J skrev:
> I'm doing some light adjustments on a tt_products shop
> 
> I've got two shipping options - letter or parcel
> Created my own typoscript values 'weightlimit' and 'replaceShipping'.
> If the total weight is higher than the weight limit, the below-mentioned
> code selects the key stored at the 'replaceShipping'-index (e.g. next 
> payment option at index '20')
> 
> However I admit this is quite a poor hardcoded hack, and it does not 
> work 100% correctly as it is not in sync with the rest of the shop.. So 
> I was hoping someone would share a more elegant solution or come up with 
> some ideas.
> 
> class.paymentshipping.php
> 
> if ($pskey == 'shipping')
> {
> if ($calculatedArray['weight'] >= 
> $this->conf['shipping.']['10.']['weightlimit'])
>                                     if ($activeArray[0] == 10) 
> {                            $activeArray[0] = 
> $this->conf['shipping.']['10.']['weightlimit.']['replaceShipping'];      
> unset($confArr[10]);
> unset($value);
>                                         $actTitle = 
> $this->conf['shipping.']['20.']['title'];
> }
>     }
> }

Ok, seems like I need to build a new function.
In class.paymentshipping.php whenever I need to access basketinformation 
in $this->basket, the computer goes nuts, why?

I need to grab the total weight, and use it for comparison with a custom 
typoscript-value - the weight limit


More information about the TYPO3-project-tt-products mailing list