News:

Looking for documentation? Take a look on our wiki

Main Menu

Hide shipping option with php when other option available

Started by kratzi, March 02, 2015, 21:39:50 PM

Previous topic - Next topic

kratzi

Hi,

I am looking very much for a solution which i guess is only one php sentence in the right file.

As a shipping rule I have usually that if the cart is higher than 50€ the shipping is free. Now I would like to set a rule that if some specific products are bought the whole shipping is also free. As there is no rule for this in VM I thought it would be a good idea to set the weight for the products I want to have for free shipping f.e. over 30kg. Then I have a rule that if the cart is over 20kg shipping is free. As all my other products don't have a weight in the database this should work fine.

I am looking for a php sentence for the correct file which says that if shipping id "2" (shipping option with weight over 20kg) is available shipping id "1" should not be visible. I would not like to hide it with css as the customer would then be forwarded to the site to choose the wanted shipping method.

I hope it is kind of clear.

I am happy for your help

Thank you

kratzi

I am using Joomla 2.5.28 and VM 2.6.14. I know it should be updated however the update will wrack my whole shop so I would need to make 80% of my template new.


GJC Web Design

shipping "conditions" are tested in the shipping plugins themselves..

can you not filter by weight there?

but if not perhaps look at the FW helpers/cart.php function CheckAutomaticSelectedShipment() perhaps there get the cart weight and return id 2..

BTW if your happy with your shop there is absolutely no need to upgrade from J2.5/VM2.6.14
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kratzi

Hi,

thank you for your answer and it is great to hear I don't need to update.

I have the feeling you misunderstood my question a bit.

I am using the shipping option to filter. I created a second shipping option and as a rule I have free shipping for products which have a weight above 20kg. If I want the product to be free of charge I just set in the product a weight of 30kg.

But in the cart the customer can still choose between the two shipping options because both are met. What I would like is that if the free option is available the paid one will not be shown. Most likely in the following view: com_virtuemart/cart/select_shipment.php

Something like:

<if shipping id=2 then do not show shipping is =1>

I appreciate your help.

Thank you

kratzi


GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kratzi

Your solution is just easy and great. I am ashamed I didn't think of it.

Thank you so much!!! I appreciate it.