irrelevant Posted August 6, 2013 Share Posted August 6, 2013 (edited) Shipping... argh... My store is set up with shipping by price by default, with a single local carrier with a single rate. I then have free shipping set for £25.00. I have (currently) a single international carrier set for Europe, with the carrier record set as price-by weight. Weight ranges are set, and prices set for each weight. This all seems to work in store. Exporting to eBay, it put international shipping on all products as "Free P&P!" I didn't notice until someone in Germany bought something and I wondered why they had not been charged postage! Looking into this, ebay.php->getShippingPriceForProduct only checks the store default for which pricing method to use to calculate the cost. A call to $carrier->getDeliveryPriceByPrice when there isn't a by-price table set up returns "false". However this is not checked for, and the tax calculation then turns this into zero, hence the free p&p ... Here's a quick fix - I can't guarantee it's bug free, but my limited testing shows it seems to work for my situation. In ebay.php, change $carrier = new Carrier($carrierid); if(Configuration::get('PS_SHIPPING_METHOD') == 1) {//Shipping by weight $price = $carrier->getDeliveryPriceByWeight($product->weight, $zone); } else {//Shipping by price $price = $carrier->getDeliveryPriceByPrice($product->price, $zone); } to $carrier = new Carrier($carrierid); switch ($carrier->shipping_method) { case 0: // default if(Configuration::get('PS_SHIPPING_METHOD') == 1) {//Shipping by weight $price = $carrier->getDeliveryPriceByWeight($product->weight, $zone); } else {//Shipping by price $price = $carrier->getDeliveryPriceByPrice($product->price, $zone); } break; case 1: // weight $price = $carrier->getDeliveryPriceByWeight($product->weight, $zone); break; case 2: // price $price = $carrier->getDeliveryPriceByPrice($product->price, $zone); break; } // switch$carrier->shipping_method) { if ($price === false) return false; // please trap this and not return Free P&P!! This makes sure the right method is chosen, and preserves the 'false' if it can't find it. Then, in eBayRequest.php, change foreach($datas['shipping']['nationalShip'] as $serviceShippingName => $serviceShipping) { $requestXml .= ' <ShippingServiceOptions>' . "\n"; $requestXml .= ' <ShippingServicePriority>' . $serviceShipping['servicePriority'] . '</ShippingServicePriority>' . "\n"; $requestXml .= ' <ShippingService>' . $serviceShippingName . '</ShippingService>' . "\n"; $requestXml .= ' <FreeShipping>false</FreeShipping>' . "\n"; $requestXml .= ' <ShippingServiceCost currencyID="' . $this->currency .'">' . $serviceShipping['serviceCosts'] . '</ShippingServiceCost>' . "\n"; $requestXml .= ' <ShippingServiceAdditionalCost>' . $serviceShipping['serviceAdditionalCosts'] . '</ShippingServiceAdditionalCost>' . "\n"; $requestXml .= ' </ShippingServiceOptions>' . "\n"; } //International Shipping Service foreach($datas['shipping']['internationalShip'] as $serviceShippingName => $serviceShipping) { $requestXml .= ' <InternationalShippingServiceOption>' . "\n"; $requestXml .= ' <ShippingServicePriority>' . $serviceShipping['servicePriority'] . '</ShippingServicePriority>' . "\n"; $requestXml .= ' <ShippingService>' . $serviceShippingName . '</ShippingService>' . "\n"; $requestXml .= ' <ShippingServiceCost currencyID="' . $this->currency .'">' . $serviceShipping['serviceCosts'] . '</ShippingServiceCost>' . "\n"; $requestXml .= ' <ShippingServiceAdditionalCost>' . $serviceShipping['serviceAdditionalCosts'] . '</ShippingServiceAdditionalCost>' . "\n"; foreach ($serviceShipping['locationToShip'] as $location) { $requestXml .= ' <ShipToLocation>' . $location['id_ebay_zone'] . '</ShipToLocation>'; } $requestXml .= ' </InternationalShippingServiceOption>' . "\n"; } to foreach($datas['shipping']['nationalShip'] as $serviceShippingName => $serviceShipping) { if ( $serviceShipping['serviceCosts'] !== false) { $requestXml .= ' <ShippingServiceOptions>' . "\n"; $requestXml .= ' <ShippingServicePriority>' . $serviceShipping['servicePriority'] . '</ShippingServicePriority>' . "\n"; $requestXml .= ' <ShippingService>' . $serviceShippingName . '</ShippingService>' . "\n"; $requestXml .= ' <FreeShipping>false</FreeShipping>' . "\n"; $requestXml .= ' <ShippingServiceCost currencyID="' . $this->currency .'">' . $serviceShipping['serviceCosts'] . '</ShippingServiceCost>' . "\n"; $requestXml .= ' <ShippingServiceAdditionalCost>' . $serviceShipping['serviceAdditionalCosts'] . '</ShippingServiceAdditionalCost>' . "\n"; $requestXml .= ' </ShippingServiceOptions>' . "\n"; } } //International Shipping Service foreach($datas['shipping']['internationalShip'] as $serviceShippingName => $serviceShipping) { if ( $serviceShipping['serviceCosts'] !== false) { $requestXml .= ' <InternationalShippingServiceOption>' . "\n"; $requestXml .= ' <ShippingServicePriority>' . $serviceShipping['servicePriority'] . '</ShippingServicePriority>' . "\n"; $requestXml .= ' <ShippingService>' . $serviceShippingName . '</ShippingService>' . "\n"; $requestXml .= ' <ShippingServiceCost currencyID="' . $this->currency .'">' . $serviceShipping['serviceCosts'] . '</ShippingServiceCost>' . "\n"; $requestXml .= ' <ShippingServiceAdditionalCost>' . $serviceShipping['serviceAdditionalCosts'] . '</ShippingServiceAdditionalCost>' . "\n"; foreach ($serviceShipping['locationToShip'] as $location) { $requestXml .= ' <ShipToLocation>' . $location['id_ebay_zone'] . '</ShipToLocation>'; } $requestXml .= ' </InternationalShippingServiceOption>' . "\n"; } } - this doesn't include shipping where there was no price found. Edited August 6, 2013 by irrelevant (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now