[+] Core : products and carriers tax rules are associated to shop
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13586 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -146,7 +146,7 @@ jQuery(document).ready(Customer.init);
|
||||
<select onChange="javascript:calcPrice(); unitPriceWithTax('unit');" name="id_tax_rules_group" id="id_tax_rules_group" {if $tax_exclude_taxe_option}disabled="disabled"{/if} >
|
||||
<option value="0">{l s='No Tax'}</option>
|
||||
{foreach from=$tax_rules_groups item=tax_rules_group}
|
||||
<option value="{$tax_rules_group.id_tax_rules_group}" {if $product->id_tax_rules_group == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
|
||||
<option value="{$tax_rules_group.id_tax_rules_group}" {if $product->getIdTaxRulesGroup() == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
|
||||
{$tax_rules_group['name']|htmlentitiesUTF8}
|
||||
</option>
|
||||
{/foreach}
|
||||
|
||||
+57
-20
@@ -47,9 +47,6 @@ class CarrierCore extends ObjectModel
|
||||
const SORT_BY_ASC = 0;
|
||||
const SORT_BY_DESC = 1;
|
||||
|
||||
/** @var int Tax id (none = 0) */
|
||||
public $id_tax_rules_group;
|
||||
|
||||
/** @var int common id for carrier historization */
|
||||
public $id_reference;
|
||||
|
||||
@@ -121,7 +118,6 @@ class CarrierCore extends ObjectModel
|
||||
'fields' => array(
|
||||
/* Classic fields */
|
||||
'id_reference' => array('type' => self::TYPE_INT),
|
||||
'id_tax_rules_group' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCarrierName', 'required' => true, 'size' => 64),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
||||
'is_free' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
@@ -164,6 +160,12 @@ class CarrierCore extends ObjectModel
|
||||
public function __construct($id = null, $id_lang = null)
|
||||
{
|
||||
parent::__construct($id, $id_lang);
|
||||
/**
|
||||
* keep retrocompatibility id_tax_rules_group
|
||||
* @deprecated 1.5.0
|
||||
*/
|
||||
if ($this->id)
|
||||
$this->id_tax_rules_group = $this->getIdTaxRulesGroup(Context::getContext());
|
||||
if ($this->name == '0')
|
||||
$this->name = Configuration::get('PS_SHOP_NAME');
|
||||
}
|
||||
@@ -193,7 +195,9 @@ class CarrierCore extends ObjectModel
|
||||
{
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id);
|
||||
return (Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id) &&
|
||||
$this->deleteTaxRulesGroup(true));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -904,23 +908,56 @@ class CarrierCore extends ObjectModel
|
||||
return $suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $id_carrier
|
||||
*/
|
||||
public static function getIdTaxRulesGroupByIdCarrier($id_carrier)
|
||||
public function getIdTaxRulesGroup(Context $context = null)
|
||||
{
|
||||
if (!isset(self::$cache_tax_rule[(int)$id_carrier]))
|
||||
{
|
||||
self::$cache_tax_rule[$id_carrier] = Db::getInstance()->getValue('
|
||||
SELECT `id_tax_rules_group`
|
||||
FROM `'._DB_PREFIX_.'carrier`
|
||||
WHERE `id_carrier` = '.(int)$id_carrier);
|
||||
}
|
||||
|
||||
return self::$cache_tax_rule[$id_carrier];
|
||||
return Carrier::getIdTaxRulesGroupByIdCarrier((int)$this->id, $context);
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupByIdCarrier($id_carrier, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
if (!Cache::isStored((int)$id_carrier.'_'.(int)$context->shop->getId(true)))
|
||||
Cache::store((int)$id_carrier.'_'.(int)$context->shop->getId(true),
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_tax_rules_group`
|
||||
FROM `'._DB_PREFIX_.'carrier_tax_rules_group_shop`
|
||||
WHERE `id_carrier` = '.(int)$id_carrier.' AND id_shop='.(int)Context::getContext()->shop->getId(true)));
|
||||
|
||||
return Cache::retrieve((int)$id_carrier.'_'.(int)$context->shop->getId(true));
|
||||
}
|
||||
|
||||
|
||||
public function deleteTaxRulesGroup($all_shops = false)
|
||||
{
|
||||
$shop = '';
|
||||
if (!$all_shops)
|
||||
$shop = ' AND `id_shop`='.(int)Context::getContext()->shop->id;
|
||||
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_tax_rules_group_shop
|
||||
WHERE id_carrier='.(int)$this->id.$shop);
|
||||
}
|
||||
|
||||
public function setTaxRulesGroup($id_tax_rules_group, $all_shops = false)
|
||||
{
|
||||
if (!Validate::isInt($id_tax_rules_group))
|
||||
die(Tools::displayError());
|
||||
|
||||
if (Context::getContext()->shop->getContextType() != Shop::CONTEXT_SHOP)
|
||||
$all_shops = true;
|
||||
|
||||
$this->deleteTaxRulesGroup($all_shops);
|
||||
|
||||
if ($all_shops)
|
||||
{
|
||||
$values = '';
|
||||
$shops = Shop::getShops(false, null, true);
|
||||
foreach ($shops as $id_shop)
|
||||
$values .= '('.(int)$this->id.','.(int)$id_tax_rules_group.','.(int)$id_shop.'),';
|
||||
}
|
||||
else
|
||||
$values = '('.(int)$this->id.','.(int)$id_tax_rules_group.','.(int)Context::getContext()->shop->id.')';
|
||||
return Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'carrier_tax_rules_group_shop (`id_carrier`, `id_tax_rules_group`, `id_shop`) VALUES '.rtrim($values, ','));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxes rate associated to the carrier
|
||||
@@ -931,7 +968,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function getTaxesRate(Address $address)
|
||||
{
|
||||
$tax_manager = TaxManagerFactory::getManager($address, $this->id_tax_rules_group);
|
||||
$tax_manager = TaxManagerFactory::getManager($address, $this->getIdTaxRulesGroup());
|
||||
$tax_calculator = $tax_manager->getTaxCalculator();
|
||||
return $tax_calculator->getTotalRate();
|
||||
}
|
||||
|
||||
+4
-1
@@ -392,8 +392,11 @@ class CartCore extends ObjectModel
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl')
|
||||
);
|
||||
$sql->leftJoin('product_tax_rules_group_shop', 'ptrgs',
|
||||
'p.`id_product` = ptrgs.`id_product` AND cp.`id_shop` = ptrgs.`id_shop`');
|
||||
|
||||
$sql->leftJoin('tax_rule', 'tr', '
|
||||
p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$id_country.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0'
|
||||
|
||||
@@ -649,6 +649,8 @@ class CategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
|
||||
ON (i.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr
|
||||
ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
|
||||
@@ -336,6 +336,8 @@ class ManufacturerCore extends ObjectModel
|
||||
ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
|
||||
ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr
|
||||
ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
@@ -452,4 +454,4 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
return ($result1 && $result2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -120,7 +120,9 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON p.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)Context::getContext()->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
@@ -156,7 +158,9 @@ class PackCore extends Product
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)Context::getContext()->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
|
||||
+78
-22
@@ -42,9 +42,6 @@ class ProductCore extends ObjectModel
|
||||
/** @var string Tax rate */
|
||||
public $tax_rate;
|
||||
|
||||
/** @var string Tax rules group */
|
||||
public $id_tax_rules_group;
|
||||
|
||||
/** @var integer Manufacturer id */
|
||||
public $id_manufacturer;
|
||||
|
||||
@@ -232,7 +229,6 @@ class ProductCore extends ObjectModel
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
// Classic fields
|
||||
'id_tax_rules_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_category_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
@@ -388,16 +384,22 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
parent::__construct($id_product, $id_lang, $id_shop);
|
||||
if (!$context)
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
/**
|
||||
* keep retrocompatibility id_tax_rules_group
|
||||
* @deprecated 1.5.0.6
|
||||
*/
|
||||
if ($this->id)
|
||||
$this->id_tax_rules_group = $this->getIdTaxRulesGroup($context);
|
||||
|
||||
if ($full && $this->id)
|
||||
{
|
||||
$this->isFullyLoaded = $full;
|
||||
$this->tax_name = 'deprecated'; // The applicable tax may be BOTH the product one AND the state one (moreover this variable is some deadcode)
|
||||
$this->manufacturer_name = Manufacturer::getNameById((int)$this->id_manufacturer);
|
||||
$this->supplier_name = Supplier::getNameById((int)$this->id_supplier);
|
||||
self::$_tax_rules_group[$this->id] = $this->id_tax_rules_group;
|
||||
|
||||
$address = null;
|
||||
if (is_object($context->cart) && $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != null)
|
||||
$address = $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
|
||||
@@ -659,7 +661,8 @@ class ProductCore extends ObjectModel
|
||||
!$this->deleteSearchIndexes() ||
|
||||
!$this->deleteAccessories() ||
|
||||
!$this->deleteFromAccessories() ||
|
||||
!$this->deleteFromSupplier())
|
||||
!$this->deleteFromSupplier() ||
|
||||
!$this->deleteTaxRulesGroup(true))
|
||||
return false;
|
||||
|
||||
if ($id = ProductDownload::getIdFromIdProduct($this->id))
|
||||
@@ -926,7 +929,9 @@ class ProductCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
@@ -1819,8 +1824,10 @@ class ProductCore extends ObjectModel
|
||||
);
|
||||
$sql->leftJoin('image', 'i', 'i.`id_product` = p.`id_product` AND i.`cover` = 1');
|
||||
$sql->leftJoin('image_lang', 'il', 'i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang);
|
||||
$sql->leftJoin('product_tax_rules_group_shop', 'ptrgs',
|
||||
'p.`id_product` = ptrgs.`id_product` AND ptrgs.`id_shop` ='.(int)$context->shop->id);
|
||||
$sql->leftJoin('tax_rule', 'tr', '
|
||||
p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
AND tr.`id_state` = 0'
|
||||
);
|
||||
@@ -1935,7 +1942,9 @@ class ProductCore extends ObjectModel
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
@@ -2019,7 +2028,9 @@ class ProductCore extends ObjectModel
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
@@ -2919,7 +2930,9 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
@@ -4021,18 +4034,61 @@ class ProductCore extends ObjectModel
|
||||
AND l.`active` = 1
|
||||
');
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupByIdProduct($id_product)
|
||||
|
||||
public static function duplicateTaxRulesGroup($id_old_product, $id_new_product)
|
||||
{
|
||||
if (!isset(self::$_tax_rules_group[$id_product]))
|
||||
return Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_tax_rules_group_shop (`id_product`, `id_tax_rules_group`, `id_shop`)
|
||||
(SELECT '.(int)$id_new_product.', `id_tax_rules_group`, `id_shop`
|
||||
FROM '._DB_PREFIX_.'product_tax_rules_group_shop WHERE `id_product`='.(int)$id_old_product.')');
|
||||
}
|
||||
|
||||
public function deleteTaxRulesGroup($all_shops = false)
|
||||
{
|
||||
$shop = '';
|
||||
if (!$all_shops)
|
||||
$shop = ' AND `id_shop`='.(int)Context::getContext()->shop->id;
|
||||
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_tax_rules_group_shop
|
||||
WHERE id_product='.(int)$this->id.$shop);
|
||||
}
|
||||
|
||||
public function setTaxRulesGroup($id_tax_rules_group, $all_shops = false)
|
||||
{
|
||||
if (!Validate::isInt($id_tax_rules_group))
|
||||
die(Tools::displayError());
|
||||
$this->deleteTaxRulesGroup($all_shops);
|
||||
|
||||
if (Context::getContext()->shop->getContextType() != Shop::CONTEXT_SHOP)
|
||||
$all_shops = true;
|
||||
|
||||
if ($all_shops)
|
||||
{
|
||||
$id_group = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_tax_rules_group`
|
||||
FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
self::$_tax_rules_group[$id_product] = $id_group;
|
||||
$values = '';
|
||||
$shops = Shop::getShops(false, null, true);
|
||||
foreach ($shops as $id_shop)
|
||||
$values .= '('.(int)$this->id.','.(int)$id_tax_rules_group.','.(int)$id_shop.'),';
|
||||
}
|
||||
return self::$_tax_rules_group[$id_product];
|
||||
else
|
||||
$values = '('.(int)$this->id.','.(int)$id_tax_rules_group.','.(int)Context::getContext()->shop->id.')';
|
||||
return Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_tax_rules_group_shop (`id_product`, `id_tax_rules_group`, `id_shop`) VALUES '.rtrim($values, ','));
|
||||
}
|
||||
|
||||
public function getIdTaxRulesGroup(Context $context = null)
|
||||
{
|
||||
return Product::getIdTaxRulesGroupByIdProduct((int)$this->id, $context);
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupByIdProduct($id_product, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
if (!Cache::isStored((int)$id_product.'_'.(int)$context->shop->id))
|
||||
Cache::store((int)$id_product.'_'.(int)$context->shop->id,
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_tax_rules_group`
|
||||
FROM `'._DB_PREFIX_.'product_tax_rules_group_shop`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND id_shop='.(int)Context::getContext()->shop->id));
|
||||
|
||||
return Cache::retrieve((int)$id_product.'_'.(int)$context->shop->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4043,7 +4099,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$address || !$address->id_country)
|
||||
$address = Address::initialize();
|
||||
|
||||
$tax_manager = TaxManagerFactory::getManager($address, $this->id_tax_rules_group);
|
||||
$tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$this->id));
|
||||
$tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
return $tax_calculator->getTotalRate();
|
||||
|
||||
@@ -96,7 +96,9 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)Context::getContext()->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`)
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
|
||||
@@ -257,7 +257,9 @@ class SupplierCore extends ObjectModel
|
||||
AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)Context::getContext()->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0)
|
||||
|
||||
@@ -2317,7 +2317,7 @@ class AdminControllerCore extends Controller
|
||||
$check_box = Tools::getValue('checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table);
|
||||
foreach ($check_box as $id_asso_object => $row)
|
||||
{
|
||||
if (!(int)$id_asso_object)
|
||||
if ($id_object)
|
||||
$id_asso_object = $id_object;
|
||||
foreach ($row as $id_shop => $value)
|
||||
$assos[] = array('id_object' => (int)$id_asso_object, 'id_'.$type => (int)$id_shop);
|
||||
|
||||
@@ -175,7 +175,9 @@ class AdminCarriersControllerCore extends AdminController
|
||||
</ul>'
|
||||
);
|
||||
$this->_select = 'b.*';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'carrier_lang` b ON a.id_carrier = b.id_carrier';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'carrier_lang` b ON a.id_carrier = b.id_carrier
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier_tax_rules_group_shop` ctrgs ON (a.`id_carrier` = ctrgs.`id_carrier`
|
||||
AND ctrgs.id_shop='.(int)$this->context->shop->id.')';
|
||||
$this->_where = 'AND b.id_lang = '.$this->context->language->id;
|
||||
|
||||
return parent::renderList();
|
||||
@@ -440,7 +442,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
return;
|
||||
|
||||
$this->getFieldsValues($obj);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -484,6 +485,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
|
||||
$this->postImage($new_carrier->id);
|
||||
$this->changeZones($new_carrier->id);
|
||||
$new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$current_carrier->id.'&conf=4&token='.$this->token);
|
||||
}
|
||||
else
|
||||
@@ -506,6 +508,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
{
|
||||
if (($_POST['id_'.$this->table] = $carrier->id /* voluntary */) && $this->postImage($carrier->id) && $this->_redirect)
|
||||
{
|
||||
$carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
$this->changeZones($carrier->id);
|
||||
$this->changeGroups($carrier->id);
|
||||
$this->updateAssoShop($carrier->id);
|
||||
@@ -565,7 +568,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
|
||||
if ($this->getFieldValue($obj, 'need_range'))
|
||||
$this->fields_value['need_range'] = 1;
|
||||
|
||||
// Added values of object Zone
|
||||
$carrier_zones = $obj->getZones();
|
||||
$carrier_zones_ids = array();
|
||||
@@ -588,6 +590,8 @@ class AdminCarriersControllerCore extends AdminController
|
||||
|
||||
foreach ($groups as $group)
|
||||
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$obj->id));
|
||||
|
||||
$this->fields_value['id_tax_rules_group'] = $this->object->getIdTaxRulesGroup($this->context);
|
||||
}
|
||||
|
||||
protected function beforeDelete($object)
|
||||
@@ -636,7 +640,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
if ($list['name'] == '0')
|
||||
$this->_list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -190,7 +190,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (a.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$this->context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
|
||||
|
||||
@@ -427,6 +429,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
|
||||
&& Product::duplicateTags($id_product_old, $product->id)
|
||||
&& Product::duplicateDownload($id_product_old, $product->id)
|
||||
&& Product::duplicateTaxRulesGroup((int)$id_product_old, (int)$product->id)
|
||||
&& $product->duplicateShops($id_product_old))
|
||||
{
|
||||
if ($product->hasAttributes())
|
||||
@@ -1412,6 +1415,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (!$this->updatePackItems($this->object))
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
$this->updateDownloadProduct($this->object);
|
||||
$this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
|
||||
if (!count($this->errors))
|
||||
{
|
||||
@@ -1506,7 +1510,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->processProductAttribute($token);
|
||||
$this->processPriceAddition($token);
|
||||
$this->processSpecificPricePriorities($token);
|
||||
|
||||
$this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'));
|
||||
if (!$this->updatePackItems($object))
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
elseif (!$object->updateCategories(Tools::getValue('categoryBox'), true))
|
||||
|
||||
@@ -1335,7 +1335,6 @@ CREATE TABLE `PREFIX_product` (
|
||||
`id_product` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_supplier` int(10) unsigned default NULL,
|
||||
`id_manufacturer` int(10) unsigned default NULL,
|
||||
`id_tax_rules_group` int(10) unsigned NOT NULL,
|
||||
`id_category_default` int(10) unsigned default NULL,
|
||||
`on_sale` tinyint(1) unsigned NOT NULL default '0',
|
||||
`online_only` tinyint(1) unsigned NOT NULL default '0',
|
||||
@@ -2402,3 +2401,19 @@ CREATE TABLE `PREFIX_module_preference` (
|
||||
PRIMARY KEY (`id_module_preference`),
|
||||
UNIQUE KEY `employee_module` (`id_employee`, `module`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_product_tax_rules_group_shop` (
|
||||
`id_product` INT(11) UNSIGNED NOT NULL,
|
||||
`id_tax_rules_group` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY ( `id_product` , `id_tax_rules_group` , `id_shop` )
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` (
|
||||
`id_carrier` int( 11 ) unsigned NOT NULL,
|
||||
`id_tax_rules_group` int(11) unsigned NOT NULL,
|
||||
`id_shop` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_carrier`, `id_tax_rules_group`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_carrier_tax_rules_group_shop>
|
||||
<fields primary="id_carrier,id_tax_rules_group,id_shop">
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_tax_rules_group" relation="tax_rules_group"/>
|
||||
<field name="id_shop" relation="shop"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<carrier_tax_rules_group_shop id="carrier_tax_rules_group_shop_1_1_1" id_carrier="carrier_1" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<carrier_tax_rules_group_shop id="carrier_tax_rules_group_shop_2_1_1" id_carrier="carrier_2" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
</entities>
|
||||
</entity_carrier_tax_rules_group_shop>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_product_tax_rules_group_shop>
|
||||
<fields primary="id_product,id_tax_rules_group,id_shop">
|
||||
<field name="id_product" relation="product"/>
|
||||
<field name="id_tax_rules_group" relation="tax_rules_group"/>
|
||||
<field name="id_shop" relation="shop"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_1_1_1" id_product="product_1" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_2_1_1" id_product="product_2" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_3_1_1" id_product="product_3" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_4_1_1" id_product="product_4" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_5_1_1" id_product="product_5" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_6_1_1" id_product="product_6" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_7_1_1" id_product="product_7" id_tax_rules_group="tax_rules_group_1" id_shop="shop_1"/>
|
||||
</entities>
|
||||
</entity_product_tax_rules_group_shop>
|
||||
@@ -2,7 +2,6 @@
|
||||
<entity_carrier>
|
||||
<fields id="name" class="Carrier" sql="a.id_carrier > 1">
|
||||
<field name="id_reference"/>
|
||||
<field name="id_tax_rules_group"/>
|
||||
<field name="name"/>
|
||||
<field name="url"/>
|
||||
<field name="active"/>
|
||||
@@ -19,7 +18,7 @@
|
||||
<field name="grade"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<carrier id="My_carrier" id_reference="2" id_tax_rules_group="1" active="1" shipping_handling="1" range_behavior="0" is_free="0" shipping_external="0" need_range="0" shipping_method="0" max_width="0" max_height="0" max_depth="0" max_weight="0" grade="0">
|
||||
<carrier id="carrier_2" id_reference="2" active="1" shipping_handling="1" range_behavior="0" is_free="0" shipping_external="0" need_range="0" shipping_method="0" max_width="0" max_height="0" max_depth="0" max_weight="0" grade="0">
|
||||
<name>My carrier</name>
|
||||
<url/>
|
||||
</carrier>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<fields id="name" class="Product">
|
||||
<field name="id_supplier" relation="supplier"/>
|
||||
<field name="id_manufacturer" relation="manufacturer"/>
|
||||
<field name="id_tax_rules_group"/>
|
||||
<field name="id_category_default" relation="category"/>
|
||||
<field name="on_sale"/>
|
||||
<field name="online_only"/>
|
||||
@@ -42,31 +41,31 @@
|
||||
<field name="advanced_stock_management"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<product id="iPod_Nano" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_tax_rules_group="1" id_category_default="iPods" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="124.581940" wholesale_price="70.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0.5" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_1" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_category_default="iPods" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="124.581940" wholesale_price="70.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0.5" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
<product id="iPod_shuffle" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_tax_rules_group="1" id_category_default="iPods" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="66.053500" wholesale_price="33.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_2" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_category_default="iPods" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="66.053500" wholesale_price="33.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
<product id="MacBook_Air" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_tax_rules_group="1" id_category_default="Laptops" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="1504.180602" wholesale_price="1000.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="1.36" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_3" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_category_default="Laptops" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="1504.180602" wholesale_price="1000.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="1.36" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
<product id="MacBook" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_tax_rules_group="1" id_category_default="Laptops" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="1170.568561" wholesale_price="0.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0.75" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_4" id_supplier="AppleStore" id_manufacturer="Apple_Computer_Inc" id_category_default="Laptops" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="1170.568561" wholesale_price="0.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0.75" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
<product id="iPod_touch" id_supplier="" id_manufacturer="" id_tax_rules_group="1" id_category_default="iPods" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="241.638796" wholesale_price="200.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_5" id_supplier="" id_manufacturer="" id_category_default="iPods" on_sale="0" online_only="0" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="241.638796" wholesale_price="200.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
<product id="Belkin_Leather_Folio_for_iPod_nano_-_Black_Chocolate" id_supplier="" id_manufacturer="" id_tax_rules_group="1" id_category_default="Accessories" on_sale="0" online_only="1" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="25.041806" wholesale_price="0.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_6" id_supplier="" id_manufacturer="" id_category_default="Accessories" on_sale="0" online_only="1" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="25.041806" wholesale_price="0.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
<product id="Shure_SE210_Sound-Isolating_Earphones_for_iPod_and_iPhone" id_supplier="Shure_Online_Store" id_manufacturer="Shure_Incorporated" id_tax_rules_group="1" id_category_default="Accessories" on_sale="0" online_only="1" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="124.581940" wholesale_price="0.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="" advanced_stock_management="0">
|
||||
<product id="product_7" id_supplier="Shure_Online_Store" id_manufacturer="Shure_Incorporated" id_category_default="Accessories" on_sale="0" online_only="1" ean13="0" upc="" ecotax="0.000000" quantity="0" minimal_quantity="1" price="124.581940" wholesale_price="0.000000" unit_price_ratio="0.000000" additional_shipping_cost="0.00" reference="" supplier_reference="" width="0" height="0" depth="0" weight="0" out_of_stock="2" quantity_discount="0" customizable="0" uploadable_files="0" text_fields="0" active="1" available_for_order="1" available_date="0000-00-00" condition="new" show_price="1" indexed="1" cache_is_pack="0" cache_has_attachments="0" is_virtual="0" cache_default_attribute="0" advanced_stock_management="0">
|
||||
<unity/>
|
||||
<location/>
|
||||
</product>
|
||||
|
||||
@@ -7,3 +7,27 @@ ALTER TABLE `PREFIX_cart_rule` ADD `gift_product_attribute` int(10) unsigned NOT
|
||||
UPDATE `PREFIX_product` set is_virtual = 1 WHERE id_product IN (SELECT id_product FROM `PREFIX_product_download` WHERE active = 1);
|
||||
|
||||
ALTER TABLE `PREFIX_employee` ADD `bo_width` int(10) unsigned NOT NULL DEFAULT 0 AFTER `bo_theme`;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `PREFIX_product_tax_rules_group_shop` (
|
||||
`id_product` INT(11) UNSIGNED NOT NULL,
|
||||
`id_tax_rules_group` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY ( `id_product`, `id_tax_rules_group`, `id_shop` )
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_product_tax_rules_group_shop` (`id_product`, `id_tax_rules_group`, `id_shop`)
|
||||
(SELECT `id_product`, `id_tax_rules_group`, `id_shop` FROM `PREFIX_product`, `PREFIX_shop`);
|
||||
ALTER TABLE `PREFIX_product` DROP `id_tax_rules_group`;
|
||||
|
||||
CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` (
|
||||
`id_carrier` int( 11 ) unsigned NOT NULL,
|
||||
`id_tax_rules_group` int(11) unsigned NOT NULL,
|
||||
`id_shop` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_carrier`, `id_tax_rules_group`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_carrier_tax_rules_group_shop` (`id_carrier`, `id_tax_rules_group`, `id_shop`)
|
||||
(SELECT `id_carrier`, `id_tax_rules_group`, `id_shop` FROM `PREFIX_carrier`, `PREFIX_shop`);
|
||||
ALTER TABLE `PREFIX_carrier` DROP `id_tax_rules_group`;
|
||||
|
||||
@@ -84,7 +84,7 @@ class BlockMyAccount extends Module
|
||||
|
||||
private function addMyAccountBlockHook()
|
||||
{
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'hook` (`name`, `title`, `description`, `position`) VALUES (\'myAccountBlock\', \'My account block\', \'Display extra informations inside the "my account" block\', 1)');
|
||||
return Db::getInstance()->execute('INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`, `description`, `position`) VALUES (\'myAccountBlock\', \'My account block\', \'Display extra informations inside the "my account" block\', 1)');
|
||||
}
|
||||
|
||||
private function removeMyAccountBlockHook()
|
||||
|
||||
@@ -77,7 +77,7 @@ class Blockmyaccountfooter extends Module
|
||||
|
||||
private function addMyAccountBlockHook()
|
||||
{
|
||||
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'hook` (`name`, `title`, `description`, `position`) VALUES (\'myAccountBlockfooter\', \'My account block\', \'Display extra informations inside the "my account" block\', 1)');
|
||||
return Db::getInstance()->Execute('INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`, `description`, `position`) VALUES (\'myAccountBlockfooter\', \'My account block\', \'Display extra informations inside the "my account" block\', 1)');
|
||||
}
|
||||
|
||||
private function removeMyAccountBlockHook()
|
||||
|
||||
Reference in New Issue
Block a user