Post by mamoon » Mon Mar 16, 2020 2:56 am

hey,
i have applied free shipping on specifics amount, but on the checkout page the option of flat shipping option is still showing,i think it should to be hide when the order is of free shipping, how can i fix that ? i'm OC v3.0.2, journal theme.
kindly see the link https://prnt.sc/rfp4st
store link https://lastchance.pk/
Best Regards.

Newbie

Posts

Joined
Thu Jun 07, 2018 4:07 pm

Post by kestas » Mon Mar 16, 2020 7:50 am

Have you tried to find on marketplace some module to restrict shipping methods on some conditions? https://www.opencart.com/index.php?rout ... _license=0

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by thekrotek » Mon Mar 16, 2020 2:38 pm

No, shipping methods don't hide themselves. If Free Shipping is available, other enabled methods will also be displayed.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by letxobnav » Mon Mar 16, 2020 3:42 pm

you can add

Code: Select all

if (($this->config->get('shipping_free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('shipping_free_total')) $status = false;

before

Code: Select all

if ($status) {

in the other shipping methods you do not want to show when free shipping applies

directory: catalog/model/extension/shipping/

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by mamoon » Mon Mar 16, 2020 4:40 pm

kestas wrote:
Mon Mar 16, 2020 7:50 am
Have you tried to find on marketplace some module to restrict shipping methods on some conditions? https://www.opencart.com/index.php?rout ... _license=0
i have tested X-Shipping does not work for me, and most of the plugins are paid!.

Newbie

Posts

Joined
Thu Jun 07, 2018 4:07 pm

Post by mamoon » Mon Mar 16, 2020 4:53 pm

letxobnav wrote:
Mon Mar 16, 2020 3:42 pm
you can add

Code: Select all

if (($this->config->get('shipping_free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('shipping_free_total')) $status = false;

before

Code: Select all

if ($status) {

in the other shipping methods you do not want to show when free shipping applies

directory: catalog/model/extension/shipping/
i have tested this also in catalog/model/extension/shipping/free.php but it does not work for me, after applying the code free shipping option does not show. Only Flat Shipping option left there.

Newbie

Posts

Joined
Thu Jun 07, 2018 4:07 pm

Post by kestas » Mon Mar 16, 2020 5:09 pm

mamoon wrote:
Mon Mar 16, 2020 4:40 pm
kestas wrote:
Mon Mar 16, 2020 7:50 am
Have you tried to find on marketplace some module to restrict shipping methods on some conditions? https://www.opencart.com/index.php?rout ... _license=0
i have tested X-Shipping does not work for me, and most of the plugins are paid!.
Have you tried this one: https://www.opencart.com/index.php?rout ... _license=0
This is not my extension, so I don't know it work or no, but you can try. It is free.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by letxobnav » Mon Mar 16, 2020 5:12 pm

try this, it takes the address in account:

Code: Select all

	// is free shipping module enabled and the cart subtotal eligible
	if (($this->config->get('shipping_free_status') == 1) && (float)$this->cart->getSubTotal() >= $this->config->get('shipping_free_total')) {
		// determine shipping is actually free based on address
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('shipping_free_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
		if (!$this->config->get('shipping_free_geo_zone_id')) {
			$free_status = true;
		} elseif ($query->num_rows) {
			$free_status = true;
		} else {
			$free_status = false;
		}
		// disable this shipping method if shipping is free
		if ($free_status) {
			$status = false;
		}
	}

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by mamoon » Mon Mar 16, 2020 6:56 pm

kestas wrote:
Mon Mar 16, 2020 5:09 pm
mamoon wrote:
Mon Mar 16, 2020 4:40 pm
kestas wrote:
Mon Mar 16, 2020 7:50 am
Have you tried to find on marketplace some module to restrict shipping methods on some conditions? https://www.opencart.com/index.php?rout ... _license=0
i have tested X-Shipping does not work for me, and most of the plugins are paid!.
Have you tried this one: https://www.opencart.com/index.php?rout ... _license=0
This is not my extension, so I don't know it work or no, but you can try. It is free.
thanks you save my life, this extension is working proper on my site, Thanks alot! :)

Newbie

Posts

Joined
Thu Jun 07, 2018 4:07 pm

Post by mamoon » Mon Mar 16, 2020 7:30 pm

letxobnav wrote:
Mon Mar 16, 2020 5:12 pm
try this, it takes the address in account:

Code: Select all

	// is free shipping module enabled and the cart subtotal eligible
	if (($this->config->get('shipping_free_status') == 1) && (float)$this->cart->getSubTotal() >= $this->config->get('shipping_free_total')) {
		// determine shipping is actually free based on address
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('shipping_free_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
		if (!$this->config->get('shipping_free_geo_zone_id')) {
			$free_status = true;
		} elseif ($query->num_rows) {
			$free_status = true;
		} else {
			$free_status = false;
		}
		// disable this shipping method if shipping is free
		if ($free_status) {
			$status = false;
		}
	}
your code looks good, i have not tested this because of the extension. but thanks alot for the help! :)

Newbie

Posts

Joined
Thu Jun 07, 2018 4:07 pm
Who is online

Users browsing this forum: No registered users and 8 guests