I run Opencart 1.5.6.4. I would like to modify the weight based shipping module. The modification should check the cart content for product ID and if let's say if product ID 0001 is in the cart I would like it to not show any of the weight based shipping options. Thank you in advance for your help!
You might be better off getting an extension for that rather then reinvent the wheel.
Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk
How about by model?wafflemeister wrote: ↑Sat Jan 18, 2025 3:55 amI run Opencart 1.5.6.4. I would like to modify the weight based shipping module. The modification should check the cart content for product ID and if let's say if product ID 0001 is in the cart I would like it to not show any of the weight based shipping options. Thank you in advance for your help!
in catalog/model/extension/shipping/weight.php
Code: Select all
$os = array("MODEL1", "MODEL2");
if (in_array($product['model'], $os)) {
$status = false;
}
if ($status) {
Mike
cue4cheap not cheap quality
If you don't want to have to modify code yourself, my Category & Product-Based Shipping (https://www.getclearthinking.com/catego ... d-shipping) extension can do this. It works on all 1.5 versions including 1.5.6.4.
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any questions.
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any questions.
Thank you Mike!Cue4cheap wrote: ↑Sat Jan 18, 2025 10:22 pmHow about by model?wafflemeister wrote: ↑Sat Jan 18, 2025 3:55 amI run Opencart 1.5.6.4. I would like to modify the weight based shipping module. The modification should check the cart content for product ID and if let's say if product ID 0001 is in the cart I would like it to not show any of the weight based shipping options. Thank you in advance for your help!
in catalog/model/extension/shipping/weight.phpPlace beforeCode: Select all
$os = array("MODEL1", "MODEL2"); if (in_array($product['model'], $os)) { $status = false; }
if ($status) {
Mike
I tried this but got the following error:
Notice: Undefined variable: product in ....public_html/catalog/model/shipping/weight.php on line 24
line 24 being:
Code: Select all
if (in_array($product['model'], $os)) {
Code: Select all
$os = array("MODEL1", "MODEL2");
Code: Select all
$os = array("actual_model_number");
Sorry but that was from memory... which is getting bad for the older versions...
In /catalog/model/shipping/weight.php
Put somewhere, maybe after: $this->language->load('shipping/weight');
$os = array("MODEL1", "MODEL2");
That needs to be the model of the product(s) you wish to have this act on
In /catalog/model/shipping/weight.php
Put somewhere, maybe after: $this->language->load('shipping/weight');
$os = array("MODEL1", "MODEL2");
That needs to be the model of the product(s) you wish to have this act on
Code: Select all
foreach ($this->cart->getProducts() as $product) {
if (in_array($product['model'], $os)) {
$status = false;
}
}
cue4cheap not cheap quality
In my opinion you should definitely use Johnathan's extension rather than start tweaking the code yourself.Johnathan wrote: ↑Sat Jan 18, 2025 11:20 pmIf you don't want to have to modify code yourself, my Category & Product-Based Shipping (https://www.getclearthinking.com/catego ... d-shipping) extension can do this. It works on all 1.5 versions including 1.5.6.4.
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any questions.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
True but your extensions could then do a lot more in future if required!
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Who is online
Users browsing this forum: clivem and 25 guests