if ($v['tag'] == "ORIGCURRENCY") { $origcurrency = $v['value']; } } $origcurrency = $origcurrency != "" ? $origcurrency : "EUR"; $RATES[$origcurrency] = 1; } $cat = new VirtuemartModelCategory(); $product = new VirtueMartModelProduct(); $image = new VirtueMartModelMedia(); $currency = new VirtueMartModelCurrency(); $config =& JFactory::getConfig(); if ($hasShipping && $add_shipping == "on") { $shipment = new VirtueMartModelShipmentmethod(); $defaultFrontEndLang = explode("-", $config->getValue('config.language')); $db = $shipment->getDbo(); $db->setQuery("SELECT virtuemart_country_id FROM #__virtuemart_countries WHERE country_2_code = '{$defaultFrontEndLang[1]}'"); $result = $db->loadAssoc(); $defaultFrontEndCountryCode = $result['virtuemart_country_id']; $db->setQuery("SELECT virtuemart_shoppergroup_id FROM #__virtuemart_shoppergroups WHERE `default` = 1"); $defaultShopperGroup = $db->loadObject(); $shippings = $shipment->getShipments(); $availableShippingMethods = array(); if (!empty($shippings) && $shippings !== null) { $pattern = '/countries=(\\[.*("' . $defaultFrontEndCountryCode . '").*\\])?("")?\\|zip_start=""\\|zip_stop=""\\|/'; foreach ($shippings as $shipping) { if ($shipping->published == 1 && preg_match($pattern, $shipping->shipment_params) && (in_array($defaultShopperGroup->virtuemart_shoppergroup_id, $shipping->virtuemart_shoppergroup_ids) || empty($shipping->virtuemart_shoppergroup_ids))) { $shipping->nbproducts_start = preg_replace('/(^.*nbproducts_start=")(.*)(".*$)/U', '\\2', $shipping->shipment_params); $shipping->nbproducts_stop = preg_replace('/(^.*nbproducts_stop=")(.*)(".*$)/U', '\\2', $shipping->shipment_params); $shipping->orderamount_start = preg_replace('/(^.*orderamount_start=")(.*)(".*$)/U', '\\2', $shipping->shipment_params); $shipping->orderamount_stop = preg_replace('/(^.*orderamount_stop=")(.*)(".*$)/U', '\\2', $shipping->shipment_params);