VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: e-trader on November 08, 2013, 18:09:29 PM

Title: Differentiate between "no country selected" and "no country + all countries "
Post by: e-trader on November 08, 2013, 18:09:29 PM
Hello all - is the following possible? It seems not and looks like a shortcoming in the rule system.

In the calculation rules, leaving countries empty means "no country selected + any country selected".
When wanting to setup a calculation rule for anonymous guests that apply when no country is selected yet, you leave country empty (rule 1). That works.
Then, how could one configure a second rule for anonymous users, specific to countries without making the first rule apply also (and get a double calculation).

One can not differentiate between "no country selected" and "no country + all countries".


VM 2.0.24. I don't expect any replies, just praying somebody from the VM team will pick this up
Title: Re: Differentiate between "no country selected" and "no country + all countries "
Post by: nkou on November 29, 2013, 15:34:09 PM
I face the same problem. However, in my case I could use a default country_id for visitor shoppers that have not set their country just yet.
Unfortunately, my hack had to be done in vm core:
administrator/components/com_virtuemart/helpers/calculationh.php (line 216, for 2.0.20b)

if ($stBased and !empty($this->_cart->ST['virtuemart_country_id'])) {
$this->_deliveryCountry = (int)$this->_cart->ST['virtuemart_country_id'];
} else if (!empty($this->_cart->BT['virtuemart_country_id'])) {
$this->_deliveryCountry = (int)$this->_cart->BT['virtuemart_country_id'];
} /*nkou: added greece id as default for visitors*/else {
$this->_deliveryCountry = 84;
}


Hopefully, we'll find a better solution.