[TYPO3-shop] Select shipping method depending on weight

Simon J simonj at removethis!mail.dk
Wed Jul 1 23:22:57 CEST 2009


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'];
}
	}
}


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