Opencart Version 2.3.0.2 - currently using Vqmod (below) to hide other shipping when free shipping is active. I am looking to adapt it to also hide free shipping if active for a particular Customer group = '2" (i.e. Wholesale customers will not see\be allowed free shipping option).
<file path="catalog/model/extension/shipping/*.php">
<operation error="skip">
<search><![CDATA[if ($status) {]]></search>
<add position="before"><![CDATA[
if (get_class($this)!='ModelExtensionShippingFree') {
if (($this->config->get('free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('free_total')) {
$status = false;
}
}
]]></add>
</operation>
</file>
Currently going round in circles, should be fairly simple but unfortunately cant crack it - any help would be appreciated.
Cheers
<file path="catalog/model/extension/shipping/*.php">
<operation error="skip">
<search><![CDATA[if ($status) {]]></search>
<add position="before"><![CDATA[
if (get_class($this)!='ModelExtensionShippingFree') {
if (($this->config->get('free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('free_total')) {
$status = false;
}
}
]]></add>
</operation>
</file>
Currently going round in circles, should be fairly simple but unfortunately cant crack it - any help would be appreciated.
Cheers
From the provided XML code, replace:
with:
Code: Select all
if (get_class($this)!='ModelExtensionShippingFree') {
if (($this->config->get('free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('free_total')) {
$status = false;
}
}
Code: Select all
$this->load->model('account/customer_group');
$customer_groups = $this->model_account_customer_group->getCustomerGroups();
$customer_group_ids = array_column($customer_groups, 'customer_group_id');
$customer_group_ids_intersect = array_intersect($customer_group_ids, array(2)); // You can add more IDs here.
if (((!$this->config->get('free_status')) || ($this->config->get('free_status') && (float)$this->cart->getTotal() > $this->config->get('free_total') && (in_array($this->config->get('config_customer_group_id'), (array)$customer_group_ids_intersect))))) {
$status = false;
}
Last edited by straightlight on Fri Mar 01, 2019 7:47 am, edited 2 times in total.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks Straightlight
Going in the right direction tried your code but unfortunately does not quite do what I want
For:
Default Customer - does not hide other shipping methods when "free shipping" is available
Wholesale above free shipping limit get the message "Warning: No Shipping options are available. Please contact us for assistance!" rather than showing the shipping methods available i.e "weight based"
Cheers
Going in the right direction tried your code but unfortunately does not quite do what I want
For:
Default Customer - does not hide other shipping methods when "free shipping" is available
Wholesale above free shipping limit get the message "Warning: No Shipping options are available. Please contact us for assistance!" rather than showing the shipping methods available i.e "weight based"
Cheers
The default customer group was not mentioned in your topic subject nor on the first post. As for the wholesale, it doesn't explain much other than what the customer group name is according to your first post. However, not to hide other shipping methods when free shipping is available would need to be done from the controllers, not from the models. You're simply on the wrong location to set the conditionings.mukur wrote: ↑Thu Feb 28, 2019 10:40 amThanks Straightlight
Going in the right direction tried your code but unfortunately does not quite do what I want
For:
Default Customer - does not hide other shipping methods when "free shipping" is available
Wholesale above free shipping limit get the message "Warning: No Shipping options are available. Please contact us for assistance!" rather than showing the shipping methods available i.e "weight based"
Cheers
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks again for input Straightlight
Apologies if my posts were confusing. The vqmod code posted in my 1st post actually successfully manages to hide other shipping methods when free shipping level is reached for both default and wholesale customers. I thought it would just be a simple tweak to get it so that free shipping would not apply(or be hidden) for Wholesale customers.
Cheers,
Update: pretty easy fix in the end just needed to include an "else if " in the code but took me a hell of a time and frustration to figure it out - hope it helps someone else
Apologies if my posts were confusing. The vqmod code posted in my 1st post actually successfully manages to hide other shipping methods when free shipping level is reached for both default and wholesale customers. I thought it would just be a simple tweak to get it so that free shipping would not apply(or be hidden) for Wholesale customers.
Cheers,
Update: pretty easy fix in the end just needed to include an "else if " in the code but took me a hell of a time and frustration to figure it out - hope it helps someone else
Code: Select all
if ($this->customer->getGroupId() != 1) {
} elseif
Hi.
This might be what i have been looking for for a long time.
In Opencart 2.1.0.2 i need to hide at checkout payment_B when payment_A is also available.
Got so far
Any help for the rest pls.
This might be what i have been looking for for a long time.
In Opencart 2.1.0.2 i need to hide at checkout payment_B when payment_A is also available.
Got so far
Code: Select all
<file name="catalog/model/payment/*.php">
<operation error=skip">
<search position="before"><![CDATA[
if (get_class($this)!='ModelPayment_A')
Last edited by straightlight on Fri Jan 31, 2020 11:26 am, edited 1 time in total.
Reason: Added code tags.
Reason: Added code tags.
Still not working
<file name="catalog/model/payment/*.php">
<operation error="skip">
<search><![CDATA[if ($status) {]]></search>
<add position="before"><![CDATA[
if (get_class($this)!='ModelPaymentMultibanco') {
($this->config->get('bank_transfer'){
$status = false;
}
}
]]></add>
</operation>
</file>
</modification>
Who is online
Users browsing this forum: No registered users and 33 guests