Post by davykong » Tue Feb 21, 2017 9:07 pm

Hi all ,

first , I'm sorry about if I'm not allow to post this file modification . I'm not sure .....

I'm not a programer also I'm not familiar with PHP . Just read around from opencart source code , copy and paste , I've tried to add some code into catalog/model/extension/shipping/free.php for the free shipping in selected item , here are the code I add before $method_data = array();

Code: Select all

 		$freeitem = $this->db->query("SELECT * FROM " . DB_PREFIX . "cart WHERE product_id = '40'");        
        if ($this->config->get('product_id')) {
			$status = false;
		} elseif ($freeitem->num_rows) {
			$status = true;
		} 
I've test on my localhost opencart 2.3.0.2 , seems working fine , it's shows free shipping on shipping methods when I add product_id above , I was wonder is that code correct ? And , how can I make it ONLY add this item with free shipping , because if I put other product (not in this code) into cart with product_id = '40' together , it will show free shipping too ...

e.g.
Set free shipping Sub-Total amount at $1000

product A (add into code) $100
product B (Not in code) $100

If only A in cart = free shipping
If A+B in cart at or above $1000 = free shipping
If only B in cart = No free shipping
If A+B in cart below $1000 = No free shipping

Thank you very much .

New member

Posts

Joined
Thu Dec 29, 2016 10:39 am
Who is online

Users browsing this forum: No registered users and 2 guests