evolution.x Posted March 14, 2012 Share Posted March 14, 2012 (edited) Hi, As the title says, does anybody know how to show the shipping cost of the product on the product.tpl or/and product-list.tpl? I think i would have to create a call to the database requesting the weight of the product displayed then another call to match up the relevant shipping cost for that weight? Any help on this will be greatly appreciated! Thanks Edited September 10, 2012 by evolution.x (see edit history) 1 Link to comment Share on other sites More sharing options...
evolution.x Posted March 23, 2012 Author Share Posted March 23, 2012 I have managed to display the shipping cost for the item on the product page, with the help of Rocky! I added the code below to product.php: $carrier = new Carrier(33, intval($cookie->id_lang)); $shippingCost = $carrier->getDeliveryPriceByWeight($product->weight, 7); $smarty->assign('shippingCost', $shippingCost); Change "33" to your carier of choice and change "7" to the zone of your choice. I then added the code below to product.tpl: {convertPrice price=$shippingCost} I am now trying to add this code to the product-list.tpl but cannot find the correct php file to add the $smarty variables? Any ideas? 2 Link to comment Share on other sites More sharing options...
evolution.x Posted September 10, 2012 Author Share Posted September 10, 2012 (edited) I am in the process of upgrading from 1.3.2.3 to 1.4.9.0. The code does not work anymore? I have changes it to the below so far but it does not display the price, only £0.00 ? $carrier = new Carrier(33, intval($cookie->id_lang)); $shippingCost = $carrier->getDeliveryPriceByWeight($product->weight, 7); self::$smarty->assign(array( 'shippingCost' => $shippingCost, )); Any ideas on what needs changing? Thanks Edited September 10, 2012 by evolution.x (see edit history) Link to comment Share on other sites More sharing options...
evolution.x Posted September 10, 2012 Author Share Posted September 10, 2012 I now have this as the code has changed from 1.3 to 1.4: $carrier = new Carrier(33, intval($cookie->id_lang)); $shippingCost = Carrier::getDeliveryPriceByWeight($this->product->weight, 7); self::$smarty->assign(array( 'shippingCost' => $shippingCost, )); This is now giving me and error: Call to undefined method ProductController::getMaxDeliveryPriceByWeight() in /home/sites/mysite.com/public_html/classes/Carrier.php on line 202 Link to comment Share on other sites More sharing options...
evolution.x Posted September 12, 2012 Author Share Posted September 12, 2012 Hi Pablus, Thanks for your input, at first looks the code you gave would not work for what i require. I am trying to show the postage cost of a product from 1 particular carrier / zone on the product page itself before product is even added to cart. Correct me if i'm wrong but the code you gave only shows the cost of shipping once product is added to cart? 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