// MERGE product_multistore branch : product fields are now editable per shop
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14682 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -18,6 +18,7 @@ fieldset{background-color:#EBEDF4; border:1px solid #CCCED7; color:#585A69; font
|
||||
.Bloc {background-color:#EBEDF4; border:1px solid #CCCED7;font-size:1.1em;margin:0;padding:1em}
|
||||
legend{background:#EBEDF4;border:1px solid #CCCED7;font-weight:700;margin:0;padding:.2em .5em;text-align:left}
|
||||
input[type="text"],input[type="password"],input[type="file"],textarea {border:1px solid #ccc; background-color:#fff;}
|
||||
input[type="text"]:disabled,input[type="password"]:disabled,input[type="file"]:disabled,textarea:disabled {border:1px solid #ccc; background-color:#dedede; color: #444444;}
|
||||
select { border:1px solid #ccc; font-size: 12px;}
|
||||
select[disabled="disabled"], input[disabled="disabled"],textarea[disabled="disabled"], option[disabled="disabled"] {border: 1px solid #CCCCCC;color: #AAAAAA}
|
||||
.header_module{background:url('../img/header_module.png');padding-left: 0.5em;padding-top: 0.8em;height:20px;color: #812143;border:solid 1px #CCC;}
|
||||
@@ -182,9 +183,9 @@ a.module_toggle_all{color: #268CCD;}
|
||||
.multishop_toolbar select.shopList { width: 300px; }
|
||||
.multishop_toolbar a.chzn-single { background: url('../img/icon-multishop.png') no-repeat 5px 5px; padding: 1px 2px 2px 25px; font-weight: bold; }
|
||||
|
||||
.multishop_toolbar .chzn-container .first{font-weight: bold;background-color: #408BD5;color: #ffffff;}
|
||||
.multishop_toolbar .chzn-container .group{font-weight: bold;font-style: italic;padding-left: 15px;background-color: #C6DEFC;}
|
||||
.multishop_toolbar .chzn-container .shop{padding-left: 30px;background-color: #EAF2FC;}
|
||||
.multishop_toolbar .chzn-container .chzn-results .first{font-weight: bold;background-color: #408BD5;color: #ffffff;}
|
||||
.multishop_toolbar .chzn-container .chzn-results .group{font-weight: bold;font-style: italic;padding-left: 15px;background-color: #C6DEFC;}
|
||||
.multishop_toolbar .chzn-container .chzn-results .shop{padding-left: 30px;background-color: #EAF2FC;}
|
||||
|
||||
/*toolbarBox*/
|
||||
.toolbarBox { background-color: #F8F8F8; border: 1px solid #CCCCCC; margin-bottom:10px; padding: 10px 0; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 321 B |
@@ -69,10 +69,10 @@
|
||||
var changeAssociationGroup = function()
|
||||
{
|
||||
var id_attribute_group = $('#id_attribute_group').val();
|
||||
$('.input_group_shop').each(function(k, item)
|
||||
$('.input_shop_group').each(function(k, item)
|
||||
{
|
||||
var id_group_shop = $(item).val();
|
||||
if (typeof shop_associations[id_attribute_group] != 'undefined' && $.inArray(id_group_shop, shop_associations[id_attribute_group]) > -1)
|
||||
var id_shop_group = $(item).val();
|
||||
if (typeof shop_associations[id_attribute_group] != 'undefined' && $.inArray(id_shop_group, shop_associations[id_attribute_group]) > -1)
|
||||
$(item).attr('disabled', false);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -66,12 +66,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{if $feature_shop_active}
|
||||
<div class="separation"></div>
|
||||
{* @todo use asso_shop from Helper *}
|
||||
<label>{l s='Shop association:'}</label>
|
||||
{$displayAssoShop}
|
||||
{/if}
|
||||
|
||||
<div class="separation"></div>
|
||||
<table>
|
||||
|
||||
@@ -40,9 +40,19 @@
|
||||
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen",
|
||||
theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,pagebreak",
|
||||
setup : function(ed) {
|
||||
|
||||
{* Count the total number of the field *}
|
||||
|
||||
ed.onInit.add(function(ed)
|
||||
{
|
||||
if (typeof load_tinymce_multishop[ed.id] != 'undefined')
|
||||
{
|
||||
if (typeof load_tinymce_multishop[ed.id])
|
||||
ed.hide();
|
||||
else
|
||||
ed.show();
|
||||
}
|
||||
});
|
||||
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
tinyMCE.triggerSave();
|
||||
textarea = $('#'+ed.id);
|
||||
@@ -94,8 +104,12 @@
|
||||
var save_error = {if $save_error}true{else}false{/if};
|
||||
|
||||
var product_type = {$product_type};
|
||||
{*var mce_maximum = '{l s='Maximum'}';
|
||||
var mce_characters = '{l s='characters'}';*}
|
||||
{*var mce_maximum = '{l s='Maximum'}';*}
|
||||
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
|
||||
var display_multishop_checkboxes = true;
|
||||
{else}
|
||||
var display_multishop_checkboxes = false;
|
||||
{/if}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
||||
@@ -23,18 +23,74 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $check_product_association_ajax}
|
||||
{assign var=class_input_ajax value='check_product_name '}
|
||||
{else}
|
||||
{assign var=class_input_ajax value=''}
|
||||
{/if}
|
||||
<input type="hidden" name="submitted_tabs[]" value="Informations" />
|
||||
<div id="step1">
|
||||
<h4 class="tab">1. {l s='Info.'}</h4>
|
||||
<h4>{l s='Product global information'}</h4>
|
||||
<script type="text/javascript">
|
||||
{$combinationImagesJs}
|
||||
{if $check_product_association_ajax}
|
||||
var search_term = '';
|
||||
$('document').ready( function() {
|
||||
$(".check_product_name")
|
||||
.autocomplete(
|
||||
'{$link->getAdminLink('AdminProducts', true)}', {
|
||||
minChars: 3,
|
||||
max: 10,
|
||||
width: $(".check_product_name").width(),
|
||||
selectFirst: false,
|
||||
scroll: false,
|
||||
dataType: "json",
|
||||
formatItem: function(data, i, max, value, term) {
|
||||
search_term = term;
|
||||
// adding the little
|
||||
if ($('.ac_results').find('.separation').length == 0)
|
||||
$('.ac_results').css('background-color', '#EFEFEF')
|
||||
.prepend('<div style="color:#585A69; padding:2px 5px">{l s='Use a product from the list'}<div class="separation"></div></div>');
|
||||
return value;
|
||||
},
|
||||
parse: function(data) {
|
||||
var mytab = new Array();
|
||||
for (var i = 0; i < data.length; i++)
|
||||
mytab[mytab.length] = { data: data[i], value: data[i].name };
|
||||
return mytab;
|
||||
},
|
||||
extraParams: {
|
||||
ajax: 1,
|
||||
action: 'checkProductName',
|
||||
id_lang: {$id_lang}
|
||||
}
|
||||
}
|
||||
)
|
||||
.result(function(event, data, formatted) {
|
||||
// keep the searched term in the input
|
||||
$('#name_{$id_lang}').val(search_term);
|
||||
jConfirm('{l s='Do you want to use this product?'} <strong>'+data.name+'</strong>', '{l s='Confirmation'}', function(confirm){
|
||||
if (confirm == true)
|
||||
document.location.href = '{$link->getAdminLink('AdminProducts', true)}&updateproduct&id_product='+data.id_product;
|
||||
else
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
{/if}
|
||||
</script>
|
||||
|
||||
{if isset($display_common_field) && $display_common_field}
|
||||
<div class="warn" style="display: block">{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}</div>
|
||||
{/if}
|
||||
|
||||
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Informations"}
|
||||
|
||||
<div class="separation"></div>
|
||||
|
||||
<div>
|
||||
<label class="text">{l s='Type:'}</label>
|
||||
<label class="text">{$bullet_common_field} {l s='Type:'}</label>
|
||||
<input type="radio" name="type_product" id="simple_product" value="{Product::PTYPE_SIMPLE}" {if $product_type == Product::PTYPE_SIMPLE}checked="checked"{/if} />
|
||||
<label class="radioCheck" for="simple_product">{l s='Product'}</label>
|
||||
<input type="radio" name="type_product" id="pack_product" value="{Product::PTYPE_PACK}" {if $product_type == Product::PTYPE_PACK}checked="checked"{/if} />
|
||||
@@ -48,35 +104,37 @@
|
||||
<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #CCCCCC;">
|
||||
{* global information *}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Name:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}
|
||||
<label>{l s='Name:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;" class="translatable">
|
||||
{foreach from=$languages item=language}
|
||||
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
|
||||
<input class="{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text" {if !$product->id}disabled="disabled"{/if}
|
||||
<input class="{$class_input_ajax}{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text" {if !$product->id}disabled="disabled"{/if}
|
||||
id="name_{$language.id_lang}" name="name_{$language.id_lang}"
|
||||
value="{$product->name[$language.id_lang]|htmlentitiesUTF8|default:''}"/><sup> *</sup>
|
||||
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer"> </span>
|
||||
</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Reference:'}</label></td>
|
||||
<td class="col-left"><label>{$bullet_common_field} {l s='Reference:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="55" type="text" name="reference" value="{$product->reference|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
|
||||
<span class="hint" name="help_box">{l s='Special characters allowed:'}.-_#\<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='EAN13 or JAN:'}</label></td>
|
||||
<td class="col-left"><label>{$bullet_common_field} {l s='EAN13 or JAN:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="55" maxlength="13" type="text" name="ean13" value="{$product->ean13|htmlentitiesUTF8}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(Europe, Japan)'}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='UPC:'}</label></td>
|
||||
<td class="col-left"><label>{$bullet_common_field} {l s='UPC:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="55" maxlength="12" type="text" name="upc" value="{$product->upc}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(US, Canada)'}</span>
|
||||
</td>
|
||||
@@ -86,6 +144,7 @@
|
||||
<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
|
||||
<label class="text">{l s='Status:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -102,7 +161,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Visibility:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="visibility" type="default"}
|
||||
<label>{l s='Visibility:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<select name="visibility" id="visibility">
|
||||
<option value="both" {if $product->visibility == 'both'}selected="selected"{/if} >{l s='Everywhere'}</option>
|
||||
@@ -113,7 +175,19 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="product_options" {if !$product->active}style="display:none"{/if} >
|
||||
<td class="col-left"><label>{l s='Options:'}</label></td>
|
||||
<td class="col-left">
|
||||
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
|
||||
<div class="multishop_product_checkbox">
|
||||
<ul class="listForm">
|
||||
<li>{include file="controllers/products/multishop/checkbox.tpl" only_checkbox="true" field="available_for_order" type="default"}</li>
|
||||
<li>{include file="controllers/products/multishop/checkbox.tpl" only_checkbox="true" field="show_price" type="show_price"}</li>
|
||||
<li>{include file="controllers/products/multishop/checkbox.tpl" only_checkbox="true" field="online_only" type="default"}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<label>{l s='Options:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<ul class="listForm">
|
||||
<li>
|
||||
@@ -128,10 +202,14 @@
|
||||
<input type="checkbox" name="online_only" id="online_only" value="1" {if $product->online_only}checked="checked"{/if} />
|
||||
<label for="online_only" class="t">{l s='online only (not sold in store)'}</label>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Condition:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="condition" type="default"}
|
||||
<label>{l s='Condition:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<select name="condition" id="condition">
|
||||
<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>
|
||||
@@ -140,13 +218,16 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</ul>
|
||||
</table>
|
||||
|
||||
<table cellpadding="5" cellspacing="0" border="0" style="width: 100%;"><tr><td><div class="separation"></div></td></tr></table>
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Short description:'}<br /></label><p class="product_description">({l s='appears in the product lists and on the top of the product page'})</p></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="description_short" type="tinymce" multilang="true"}
|
||||
<label>{l s='Short description:'}<br /></label>
|
||||
<p class="product_description">({l s='appears in the product lists and on the top of the product page'})</p>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="controllers/products/textarea_lang.tpl"
|
||||
languages=$languages
|
||||
@@ -157,7 +238,11 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Description:'}<br /></label><p class="product_description">({l s='appears in the body of the product page'})</p></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="description" type="tinymce" multilang="true"}
|
||||
<label>{l s='Description:'}<br /></label>
|
||||
<p class="product_description">({l s='appears in the body of the product page'})</p>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="controllers/products/textarea_lang.tpl" languages=$languages
|
||||
input_name='description'
|
||||
@@ -257,4 +342,3 @@
|
||||
</table>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 9856 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
|
||||
<label style="float: none">
|
||||
<input type="checkbox" style="vertical-align: text-bottom" onclick="$('input[name^=\'multishop_check[\']').attr('checked', this.checked); multishopCheckAllProductFields{$product_tab}()" />
|
||||
{l s='Check / uncheck all (you are editing this page for several shops, some fields like "name" or "price" are disabled, you have to check these fields in order to edit them for these shops)'}
|
||||
</label>
|
||||
{/if}
|
||||
@@ -0,0 +1,51 @@
|
||||
{*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 9856 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
|
||||
{if isset($multilang) && $multilang}
|
||||
{if isset($only_checkbox)}
|
||||
{foreach from=$languages item=language}
|
||||
<input type="checkbox" name="multishop_check[{$field}][{$language.id_lang}]" value="1" onclick="multishopCheckProductField(this.checked, '{$field}_{$language.id_lang}', '{$type}')" {if !empty($multishop_check[$field][$language.id_lang])}checked="checked"{/if} />
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="multishop_product_checkbox">
|
||||
{foreach from=$languages item=language}
|
||||
<div class="multishop_lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if}">
|
||||
<input type="checkbox" name="multishop_check[{$field}][{$language.id_lang}]" value="1" onclick="multishopCheckProductField(this.checked, '{$field}_{$language.id_lang}', '{$type}')" {if !empty($multishop_check[$field][$language.id_lang])}checked="checked"{/if} />
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{else}
|
||||
{if isset($only_checkbox)}
|
||||
<input type="checkbox" name="multishop_check[{$field}]" value="1" onclick="multishopCheckProductField(this.checked, '{$field}', '{$type}')" {if !empty($multishop_check[$field])}checked="checked"{/if} />
|
||||
{else}
|
||||
<div class="multishop_product_checkbox">
|
||||
<input type="checkbox" name="multishop_check[{$field}]" value="1" onclick="multishopCheckProductField(this.checked, '{$field}', '{$type}')" {if !empty($multishop_check[$field])}checked="checked"{/if} />
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -106,18 +106,27 @@ jQuery(document).ready(Customer.init);
|
||||
<div class="hint" style="display:block;min-height:0;">
|
||||
{l s='You must enter either the pre-tax retail price, or the retail price with tax. The input field will be automatically calculated.'}
|
||||
</div>
|
||||
|
||||
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Price"}
|
||||
|
||||
<div class="separation"></div>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax wholesale price:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}
|
||||
<label>{l s='Pre-tax wholesale price:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" name="wholesale_price" type="text" value="{$product->wholesale_price|string_format:'%.2f'}" onchange="this.value = this.value.replace(/,/g, '.');" />{$currency->suffix}
|
||||
{$currency->prefix}<input size="11" maxlength="14" name="wholesale_price" id="wholesale_price" type="text" value="{$product->wholesale_price|string_format:'%.2f'}" onchange="this.value = this.value.replace(/,/g, '.');" />{$currency->suffix}
|
||||
<p class="preference_description">{l s='The wholesale price at which you bought this product'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax retail price:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="price" type="price"}
|
||||
<label>{l s='Pre-tax retail price:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input type="hidden" id="priceTEReal" name="price" value="{$product->price}" />
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="priceTE" name="price_displayed" type="text" value="{$product->price|string_format:'%.2f'}" onchange="noComma('priceTE'); $('#priceTEReal').val(this.value);" onkeyup="$('#priceType').val('TE'); $('#priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return; calcPriceTI();" />{$currency->suffix}
|
||||
@@ -125,7 +134,10 @@ jQuery(document).ready(Customer.init);
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Tax rule:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="id_tax_rules_group" type="default"}
|
||||
<label>{l s='Tax rule:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<script type="text/javascript">
|
||||
noTax = {if $tax_exclude_taxe_option}true{else}false{/if};
|
||||
@@ -177,7 +189,10 @@ jQuery(document).ready(Customer.init);
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_unit_price">
|
||||
<td class="col-left"><label>{l s='Unit price:'}</label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="unit_price" type="unit_price"}
|
||||
<label>{l s='Unit price:'}</label>
|
||||
</td>
|
||||
<td>
|
||||
{$currency->prefix} <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="{$unit_price|string_format:'%.2f'}"
|
||||
onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');"/>{$currency->suffix}
|
||||
@@ -197,7 +212,10 @@ jQuery(document).ready(Customer.init);
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label> </label></td>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="on_sale" type="default"}
|
||||
<label> </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="on_sale" id="on_sale" style="padding-top: 5px;" {if $product->on_sale}checked="checked"{/if} value="1" /> <label for="on_sale" class="t">{l s='Display "on sale" icon on product page and text on product listing'}</label>
|
||||
</td>
|
||||
|
||||
@@ -26,11 +26,15 @@
|
||||
|
||||
<input type="hidden" name="submitted_tabs[]" value="Seo" />
|
||||
<h4>{l s='SEO'}</h4>
|
||||
|
||||
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Seo"}
|
||||
|
||||
<div class="separation"></div>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="meta_title" type="default" multilang="true"}
|
||||
<label>{l s='Meta title:'}</label>
|
||||
</td>
|
||||
<td>
|
||||
@@ -43,6 +47,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}
|
||||
<label>{l s='Meta description:'}</label>
|
||||
</td>
|
||||
<td>
|
||||
@@ -56,6 +61,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="meta_keywords" type="default" multilang="true"}
|
||||
<label>{l s='Meta keywords:'}</label>
|
||||
</td>
|
||||
<td>
|
||||
@@ -67,6 +73,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
{include file="controllers/products/multishop/checkbox.tpl" field="link_rewrite" type="default" multilang="true"}
|
||||
<label>{l s='Friendly URL:'}</label>
|
||||
</td>
|
||||
<td>
|
||||
@@ -84,5 +91,3 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
@@ -28,31 +28,35 @@
|
||||
<h4 class="tab">1. {l s='Info.'}</h4>
|
||||
<h4>{l s='Shipping'}</h4>
|
||||
|
||||
{if isset($display_common_field) && $display_common_field}
|
||||
<div class="hint" style="display: block">{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}</div>
|
||||
{/if}
|
||||
|
||||
<div class="separation"></div>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Width (package):'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="6" maxlength="6" name="width" type="text" value="{$product->width}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" /> {$ps_dimension_unit}
|
||||
<input size="6" maxlength="6" name="width" type="text" value="{$product->width}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{$bullet_common_field} {$ps_dimension_unit}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Height (package):'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="6" maxlength="6" name="height" type="text" value="{$product->height}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" /> {$ps_dimension_unit}
|
||||
<input size="6" maxlength="6" name="height" type="text" value="{$product->height}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{$bullet_common_field} {$ps_dimension_unit}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Depth (package):'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="6" maxlength="6" name="depth" type="text" value="{$product->depth}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" /> {$ps_dimension_unit}
|
||||
<input size="6" maxlength="6" name="depth" type="text" value="{$product->depth}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{$bullet_common_field} {$ps_dimension_unit}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Weight (package):'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="6" maxlength="6" name="weight" type="text" value="{$product->weight}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" /> {$ps_weight_unit}
|
||||
<input size="6" maxlength="6" name="weight" type="text" value="{$product->weight}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{$bullet_common_field} {$ps_weight_unit}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
{block name="label"}
|
||||
{if $input.type == 'text' && $input.name == 'name'}
|
||||
<div class="hint" name="help_box" style="display:block;">{l s='You can\'t change the GroupShop when you have more than one Shop'}</div><br />
|
||||
<div class="hint" name="help_box" style="display:block;">{l s='You can\'t change the shop group when you have more than one Shop'}</div><br />
|
||||
{/if}
|
||||
{$smarty.block.parent}
|
||||
{/block}
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="clear"> </div>
|
||||
{elseif $input.type == 'textGroupShop'}
|
||||
{elseif $input.type == 'textShopGroup'}
|
||||
{$input.value}
|
||||
{else}
|
||||
{if $input.type == 'select' && $input.name == 'id_category'}
|
||||
|
||||
+2
-48
@@ -67,57 +67,11 @@
|
||||
{block name="label"}
|
||||
|
||||
{if $input.type == 'text' && $input.name == 'name'}
|
||||
<div class="hint" name="help_box" style="display:block;">{l s='You can\'t edit GroupShop when you have more than one shop'}</div><br />
|
||||
<div class="hint" name="help_box" style="display:block;">{l s='You can\'t edit the shop group when you have more than one shop'}</div><br />
|
||||
{/if}
|
||||
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="other_fieldsets"}
|
||||
{if isset($form_import)}
|
||||
<br /><br />
|
||||
<fieldset>
|
||||
{foreach $form_import as $key => $field}
|
||||
{if $key == 'legend'}
|
||||
<legend>
|
||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
|
||||
{$field.title}
|
||||
</legend>
|
||||
{elseif $key == 'label'}
|
||||
<label>{$field}</label>
|
||||
{/if}
|
||||
<div class="clear"></div>
|
||||
{if $key == 'checkbox'}
|
||||
<div class="margin-form">
|
||||
<label><input type="{$field.type}" value="{$field.value}" name="{$field.name}" id="{$field.name}" {if $checked} checked="checked"{/if}/> {$field.label}</label>
|
||||
{elseif $key == 'select'}
|
||||
<select name="{$field.name}" id="{$field.name}">
|
||||
{foreach $field.options.query AS $key => $option}
|
||||
<option value="{$key}" {if $key == $defaultGroup}selected="selected"{/if}>
|
||||
{$option.name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{elseif $key == 'allcheckbox'}
|
||||
<div id="importList" {if !$checked}style="display:none"{/if}>
|
||||
<ul>
|
||||
{foreach $field.values as $key => $label}
|
||||
<li><label><input type="checkbox" name="importData[{$key}]" checked="checked" /> {$label}</label></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{elseif $key == 'p'}
|
||||
<p>{$field}</p>
|
||||
</div>
|
||||
{elseif $key == 'submit'}
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="{$field.title}" name="submitAdd{$table}" {if isset($field.class)}class="{$field.class}"{/if} />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</fieldset>
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
@@ -221,7 +221,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $display_header && $is_multishop && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
|
||||
{if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
|
||||
<div class="multishop_toolbar">
|
||||
<span class="text_multishop">{l s='Multishop configuration for'}</span>
|
||||
{$shop_list}
|
||||
|
||||
@@ -29,30 +29,30 @@ $().ready(function() {
|
||||
// Click on "all shop"
|
||||
$('.input_all_shop').live('click', function() {
|
||||
var checked = $(this).attr('checked');
|
||||
$('.input_group_shop:not(:disabled)').attr('checked', checked);
|
||||
$('.input_shop_group:not(:disabled)').attr('checked', checked);
|
||||
$('.input_shop:not(:disabled)').attr('checked', checked);
|
||||
});
|
||||
|
||||
// Click on a group shop
|
||||
$('.input_group_shop').live('click', function() {
|
||||
$('.input_shop_group').live('click', function() {
|
||||
$('.input_shop[value='+$(this).val()+']').attr('checked', $(this).attr('checked'));
|
||||
check_all_shop();
|
||||
});
|
||||
|
||||
// Click on a shop
|
||||
$('.input_shop').live('click', function() {
|
||||
check_group_shop_status($(this).val());
|
||||
check_shop_group_status($(this).val());
|
||||
check_all_shop();
|
||||
});
|
||||
|
||||
// Initialize checkbox
|
||||
$('.input_group_shop').each(function(k, v) {
|
||||
check_group_shop_status($(v).val());
|
||||
$('.input_shop_group').each(function(k, v) {
|
||||
check_shop_group_status($(v).val());
|
||||
check_all_shop();
|
||||
});
|
||||
});
|
||||
|
||||
function check_group_shop_status(id_group) {
|
||||
function check_shop_group_status(id_group) {
|
||||
var groupChecked = true;
|
||||
var total = 0;
|
||||
$('.input_shop[value='+id_group+']').each(function(k, v) {
|
||||
@@ -62,12 +62,12 @@ function check_group_shop_status(id_group) {
|
||||
});
|
||||
|
||||
if (total > 0)
|
||||
$('.input_group_shop[value='+id_group+']').attr('checked', groupChecked);
|
||||
$('.input_shop_group[value='+id_group+']').attr('checked', groupChecked);
|
||||
}
|
||||
|
||||
function check_all_shop() {
|
||||
var allChecked = true;
|
||||
$('.input_group_shop:not(:disabled)').each(function(k, v) {
|
||||
$('.input_shop_group:not(:disabled)').each(function(k, v) {
|
||||
if (!$(v).attr('checked'))
|
||||
allChecked = false;
|
||||
});
|
||||
@@ -78,26 +78,22 @@ function check_all_shop() {
|
||||
<div class="assoShop">
|
||||
<table class="table" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>{if $input.type == 'group_shop'}{l s='Group shop'}{else}{l s='Shop'}{/if}</th>
|
||||
<th>{l s='Shop'}</th>
|
||||
</tr>
|
||||
<tr {if $input.type == 'group_shop'}class="alt_row"{/if}>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="t"><input class="input_all_shop" type="checkbox" /> <b>{if $input.type == 'group_shop'}{l s='All group shops'}{else}{l s='All shops'}{/if}</b></label>
|
||||
<label class="t"><input class="input_all_shop" type="checkbox" /> <b>{l s='All shops'}</b></label>
|
||||
</td>
|
||||
</tr>
|
||||
{foreach $input.values as $groupID => $groupData}
|
||||
{if ($input.type == 'group_shop' && isset($fields_value.shop[$groupID]))}
|
||||
{assign var=groupChecked value=true}
|
||||
{else}
|
||||
{assign var=groupChecked value=false}
|
||||
{/if}
|
||||
<tr {if $input.type == 'shop'}class="alt_row"{/if}>
|
||||
<td>
|
||||
<img style="vertical-align:middle;" alt="" src="../img/admin/lv2_b.gif" />
|
||||
<label class="t">
|
||||
<input class="input_group_shop"
|
||||
<input class="input_shop_group"
|
||||
type="checkbox"
|
||||
name="checkBoxGroupShopAsso_{$table}[{$form_id}][{$groupID}]"
|
||||
name="checkBoxShopGroupAsso_{$table}[{$form_id}][{$groupID}]"
|
||||
value="{$groupID}"
|
||||
{if $groupChecked} checked="checked"{/if} />
|
||||
<b>{l s='Group:'} {$groupData['name']}</b>
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
{elseif $input.type == 'group'}
|
||||
{assign var=groups value=$input.values}
|
||||
{include file='helpers/form/form_group.tpl'}
|
||||
{elseif $input.type == 'shop' OR $input.type == 'group_shop'}
|
||||
{elseif $input.type == 'shop'}
|
||||
{$input.html}
|
||||
{elseif $input.type == 'categories'}
|
||||
{include file='helpers/form/form_category.tpl' categories=$input.values}
|
||||
|
||||
@@ -58,11 +58,21 @@
|
||||
<p>{$categoryData['info']}</p>
|
||||
{/if}
|
||||
|
||||
{if $use_multishop}
|
||||
<input type="checkbox" style="vertical-align: text-top" checked="checked" onclick="checkAllMultishopDefaultValue(this)" /> <b>{l s='Uncheck / check all'}</b> {l s='(uncheck boxes if you want to set a custom value for this shop or group shop context)'}
|
||||
<div class="separation"></div>
|
||||
{/if}
|
||||
|
||||
{foreach $categoryData['fields'] AS $key => $field}
|
||||
{if $field['type'] == 'hidden'}
|
||||
<input type="hidden" name="{$key}" value="{$field['value']}" />
|
||||
{else}
|
||||
<div style="clear: both; padding-top:15px;" id="conf_id_{$key}" {if $field['is_invisible']} class="isInvisible"{/if}>
|
||||
{if ($field['multishop_default'])}
|
||||
<div class="preference_default_multishop">
|
||||
<input type="checkbox" name="configUseDefault[{$key}]" value="1" {if $field['is_disabled']} checked="checked"{/if} onclick="checkMultishopDefaultValue(this, '{$key}')" />
|
||||
</div>
|
||||
{/if}
|
||||
{block name="label"}
|
||||
{if isset($field['title'])}
|
||||
<label class="conf_title">
|
||||
@@ -170,13 +180,6 @@
|
||||
{/if}
|
||||
{if isset($field['hint'])}<span class="hint" name="help_box">{$field['hint']}<span class="hint-pointer"> </span></span>{/if}
|
||||
{/block}{* end block input *}
|
||||
{if ($field['multishop_default'])}
|
||||
<div class="preference_default_multishop">
|
||||
<label>
|
||||
<input type="checkbox" name="configUseDefault[{$key}]" value="1" {if $field['is_disabled']} checked="checked"{/if} onclick="checkMultishopDefaultValue(this, '{$key}')" /> {l s='Use default value'}
|
||||
</label>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($field['desc'])}<p class="preference_description">{$field['desc']}</p>{/if}
|
||||
{if $field['is_invisible']}<p class="warn">{l s='You can\'t change the value of this configuration field in the context of this shop'}</p>{/if}
|
||||
</div>
|
||||
|
||||
Vendored
+4
-4
@@ -76,8 +76,6 @@
|
||||
'AdminGendersControllerCore' => 'controllers/admin/AdminGendersController.php',
|
||||
'AdminGeolocationController' => 'override/controllers/admin/AdminGeolocationController.php',
|
||||
'AdminGeolocationControllerCore' => 'controllers/admin/AdminGeolocationController.php',
|
||||
'AdminGroupShopController' => 'override/controllers/admin/AdminGroupShopController.php',
|
||||
'AdminGroupShopControllerCore' => 'controllers/admin/AdminGroupShopController.php',
|
||||
'AdminGroupsController' => 'override/controllers/admin/AdminGroupsController.php',
|
||||
'AdminGroupsControllerCore' => 'controllers/admin/AdminGroupsController.php',
|
||||
'AdminHomeController' => 'override/controllers/admin/AdminHomeController.php',
|
||||
@@ -156,6 +154,8 @@
|
||||
'AdminShippingControllerCore' => 'controllers/admin/AdminShippingController.php',
|
||||
'AdminShopController' => 'override/controllers/admin/AdminShopController.php',
|
||||
'AdminShopControllerCore' => 'controllers/admin/AdminShopController.php',
|
||||
'AdminShopGroupController' => 'override/controllers/admin/AdminShopGroupController.php',
|
||||
'AdminShopGroupControllerCore' => 'controllers/admin/AdminShopGroupController.php',
|
||||
'AdminShopUrlController' => 'override/controllers/admin/AdminShopUrlController.php',
|
||||
'AdminShopUrlControllerCore' => 'controllers/admin/AdminShopUrlController.php',
|
||||
'AdminSlipController' => 'override/controllers/admin/AdminSlipController.php',
|
||||
@@ -346,8 +346,6 @@
|
||||
'GroupCore' => 'classes/Group.php',
|
||||
'GroupReduction' => 'override/classes/GroupReduction.php',
|
||||
'GroupReductionCore' => 'classes/GroupReduction.php',
|
||||
'GroupShop' => 'override/classes/shop/GroupShop.php',
|
||||
'GroupShopCore' => 'classes/shop/GroupShop.php',
|
||||
'Guest' => 'override/classes/Guest.php',
|
||||
'GuestCore' => 'classes/Guest.php',
|
||||
'GuestTrackingController' => 'override/controllers/front/GuestTrackingController.php',
|
||||
@@ -548,6 +546,8 @@
|
||||
'SearchEngineCore' => 'classes/SearchEngine.php',
|
||||
'Shop' => 'override/classes/shop/Shop.php',
|
||||
'ShopCore' => 'classes/shop/Shop.php',
|
||||
'ShopGroup' => 'override/classes/shop/ShopGroup.php',
|
||||
'ShopGroupCore' => 'classes/shop/ShopGroup.php',
|
||||
'ShopUrl' => 'override/classes/shop/ShopUrl.php',
|
||||
'ShopUrlCore' => 'classes/shop/ShopUrl.php',
|
||||
'SitemapController' => 'override/controllers/front/SitemapController.php',
|
||||
|
||||
+26
-46
@@ -98,7 +98,7 @@ abstract class AdminTabCore
|
||||
|
||||
public $optionTitle = null;
|
||||
|
||||
/** @var string shop | group_shop */
|
||||
/** @var string shop */
|
||||
public $shopLinkType;
|
||||
|
||||
/** @var bool */
|
||||
@@ -923,12 +923,8 @@ abstract class AdminTabCore
|
||||
|
||||
protected static function getAssoShop($table, $id_object = false)
|
||||
{
|
||||
$shopAsso = Shop::getAssoTables();
|
||||
$groupShopAsso = GroupShop::getAssoTables();
|
||||
if (isset($shopAsso[$table]) && $shopAsso[$table]['type'] == 'shop')
|
||||
if (Shop::isTableAssociated($table))
|
||||
$type = 'shop';
|
||||
else if (isset($groupShopAsso[$table]) && $groupShopAsso[$table]['type'] == 'group_shop')
|
||||
$type = 'group_shop';
|
||||
else
|
||||
return;
|
||||
|
||||
@@ -1313,15 +1309,6 @@ abstract class AdminTabCore
|
||||
$filterKey = $assos[$this->table]['type'];
|
||||
$idenfierShop = Shop::getContextListShopID();
|
||||
}
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
$assos = GroupShop::getAssoTables();
|
||||
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'group_shop')
|
||||
{
|
||||
$filterKey = $assos[$this->table]['type'];
|
||||
$idenfierShop = array(Shop::getContextGroupShopID());
|
||||
}
|
||||
}
|
||||
|
||||
$filterShop = '';
|
||||
if (isset($filterKey))
|
||||
@@ -2328,19 +2315,16 @@ abstract class AdminTabCore
|
||||
$this->l('Click here if you want to modify the main shop domain name').'</a>');
|
||||
}
|
||||
|
||||
protected function displayAssoShop($type = 'shop')
|
||||
protected function displayAssoShop()
|
||||
{
|
||||
if (!Shop::isFeatureActive() || (!$this->_object && Shop::getContext() != Shop::CONTEXT_ALL))
|
||||
return;
|
||||
|
||||
if ($type != 'shop' && $type != 'group_shop')
|
||||
$type = 'shop';
|
||||
|
||||
$assos = array();
|
||||
$sql = 'SELECT id_'.$type.', `'.pSQL($this->identifier).'`
|
||||
FROM `'._DB_PREFIX_.pSQL($this->table).'_'.$type.'`';
|
||||
$sql = 'SELECT id_shop, `'.pSQL($this->identifier).'`
|
||||
FROM `'._DB_PREFIX_.pSQL($this->table).'_shop`';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$assos[$row['id_'.$type]][] = $row[$this->identifier];
|
||||
$assos[$row['id_shop']][] = $row[$this->identifier];
|
||||
|
||||
$html = <<<EOF
|
||||
<script type="text/javascript">
|
||||
@@ -2350,12 +2334,12 @@ abstract class AdminTabCore
|
||||
$('.input_all_shop').click(function()
|
||||
{
|
||||
var checked = $(this).attr('checked');
|
||||
$('.input_group_shop').attr('checked', checked);
|
||||
$('.input_shop_group').attr('checked', checked);
|
||||
$('.input_shop').attr('checked', checked);
|
||||
});
|
||||
|
||||
// Click on a group shop
|
||||
$('.input_group_shop').click(function()
|
||||
$('.input_shop_group').click(function()
|
||||
{
|
||||
$('.input_shop[value='+$(this).val()+']').attr('checked', $(this).attr('checked'));
|
||||
check_all_shop();
|
||||
@@ -2364,19 +2348,19 @@ abstract class AdminTabCore
|
||||
// Click on a shop
|
||||
$('.input_shop').click(function()
|
||||
{
|
||||
check_group_shop_status($(this).val());
|
||||
check_shop_group_status($(this).val());
|
||||
check_all_shop();
|
||||
});
|
||||
|
||||
// Initialize checkbox
|
||||
$('.input_shop').each(function(k, v)
|
||||
{
|
||||
check_group_shop_status($(v).val());
|
||||
check_shop_group_status($(v).val());
|
||||
check_all_shop();
|
||||
});
|
||||
});
|
||||
|
||||
function check_group_shop_status(id_group)
|
||||
function check_shop_group_status(id_group)
|
||||
{
|
||||
var groupChecked = true;
|
||||
$('.input_shop[value='+id_group+']').each(function(k, v)
|
||||
@@ -2384,13 +2368,13 @@ abstract class AdminTabCore
|
||||
if (!$(v).attr('checked'))
|
||||
groupChecked = false;
|
||||
});
|
||||
$('.input_group_shop[value='+id_group+']').attr('checked', groupChecked);
|
||||
$('.input_shop_group[value='+id_group+']').attr('checked', groupChecked);
|
||||
}
|
||||
|
||||
function check_all_shop()
|
||||
{
|
||||
var allChecked = true;
|
||||
$('.input_group_shop').each(function(k, v)
|
||||
$('.input_shop_group').each(function(k, v)
|
||||
{
|
||||
if (!$(v).attr('checked'))
|
||||
allChecked = false;
|
||||
@@ -2403,28 +2387,24 @@ EOF;
|
||||
$html .= '<div class="assoShop">';
|
||||
$html .= '<table class="table" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr><th>'.$this->l('Shop').'</th></tr>';
|
||||
$html .= '<tr'.(($type == 'group_shop') ? ' class="alt_row"' : '').'><td><label class="t"><input class="input_all_shop" type="checkbox" /> '.$this->l('All shops').'</label></td></tr>';
|
||||
$html .= '<tr><td><label class="t"><input class="input_all_shop" type="checkbox" /> '.$this->l('All shops').'</label></td></tr>';
|
||||
foreach (Shop::getTree() as $groupID => $groupData)
|
||||
{
|
||||
$groupChecked = ($type == 'group_shop' && ((isset($assos[$groupID]) && in_array($this->_object->id, $assos[$groupID])) || !$this->_object->id));
|
||||
$html .= '<tr'.(($type == 'shop') ? ' class="alt_row"' : '').'>';
|
||||
$html .= '<td><img style="vertical-align: middle;" alt="" src="../img/admin/lv2_b.gif" /><label class="t"><input class="input_group_shop" type="checkbox" name="checkBoxGroupShopAsso_'.$this->table.'_'.$this->_object->id.'_'.$groupID.'" value="'.$groupID.'" '.($groupChecked ? 'checked="checked"' : '').' /> '.$groupData['name'].'</label></td>';
|
||||
$html .= '<tr class="alt_row">';
|
||||
$html .= '<td><img style="vertical-align: middle;" alt="" src="../img/admin/lv2_b.gif" /><label class="t"><input class="input_shop_group" type="checkbox" name="checkBoxShopGroupAsso_'.$this->table.'_'.$this->_object->id.'_'.$groupID.'" value="'.$groupID.'" '.($groupChecked ? 'checked="checked"' : '').' /> '.$groupData['name'].'</label></td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
if ($type == 'shop')
|
||||
$total = count($groupData['shops']);
|
||||
$j = 0;
|
||||
foreach ($groupData['shops'] as $shopID => $shopData)
|
||||
{
|
||||
$total = count($groupData['shops']);
|
||||
$j = 0;
|
||||
foreach ($groupData['shops'] as $shopID => $shopData)
|
||||
{
|
||||
$checked = ((isset($assos[$shopID]) && in_array($this->_object->id, $assos[$shopID])) || !$this->_object->id);
|
||||
$html .= '<tr>';
|
||||
$html .= '<td><img style="vertical-align: middle;" alt="" src="../img/admin/lv3_'.(($j < $total - 1) ? 'b' : 'f').'.png" /><label class="child">';
|
||||
$html .= '<input class="input_shop" type="checkbox" value="'.$groupID.'" name="checkBoxShopAsso_'.$this->table.'_'.$this->_object->id.'_'.$shopID.'" id="checkedBox_'.$shopID.'" '.($checked ? 'checked="checked"' : '').' /> ';
|
||||
$html .= $shopData['name'].'</label></td>';
|
||||
$html .= '</tr>';
|
||||
$j++;
|
||||
}
|
||||
$checked = ((isset($assos[$shopID]) && in_array($this->_object->id, $assos[$shopID])) || !$this->_object->id);
|
||||
$html .= '<tr>';
|
||||
$html .= '<td><img style="vertical-align: middle;" alt="" src="../img/admin/lv3_'.(($j < $total - 1) ? 'b' : 'f').'.png" /><label class="child">';
|
||||
$html .= '<input class="input_shop" type="checkbox" value="'.$groupID.'" name="checkBoxShopAsso_'.$this->table.'_'.$this->_object->id.'_'.$shopID.'" id="checkedBox_'.$shopID.'" '.($checked ? 'checked="checked"' : '').' /> ';
|
||||
$html .= $shopData['name'].'</label></td>';
|
||||
$html .= '</tr>';
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$html .= '</table></div>';
|
||||
|
||||
@@ -135,12 +135,9 @@ class AttachmentCore extends ObjectModel
|
||||
if ((int)$id_attachment > 0)
|
||||
$ids[] = array('id_product' => (int)$id_product, 'id_attachment' => (int)$id_attachment);
|
||||
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'product
|
||||
SET cache_has_attachments = '.(count($ids) ? '1' : '0').'
|
||||
WHERE id_product = '.(int)$id_product.'
|
||||
LIMIT 1
|
||||
');
|
||||
Db::getInstance()->update('product', array(
|
||||
'cache_has_attachments' => count($ids) ? 1 : 0
|
||||
), 'id_product = '.(int)$id_product);
|
||||
|
||||
if (!empty($ids))
|
||||
$result2 = Db::getInstance()->insert('product_attachment', $ids);
|
||||
|
||||
+7
-11
@@ -88,15 +88,10 @@ class AttributeCore extends ObjectModel
|
||||
foreach ($result as $row)
|
||||
$combination_ids[] = (int)$row['id_product_attribute'];
|
||||
|
||||
if (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `'.$this->def['primary'].'` = '.(int)$this->id) === false)
|
||||
return false;
|
||||
|
||||
if (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product_attribute` IN ('.implode(', ', $combination_ids).')') === false)
|
||||
return false;
|
||||
$combinations = new Collection('Combination');
|
||||
$combinations->where('id_product', '=', $this->id);
|
||||
foreach ($combinations as $combination)
|
||||
$combination->delete();
|
||||
}
|
||||
|
||||
/* Reinitializing position */
|
||||
@@ -241,8 +236,9 @@ class AttributeCore extends ObjectModel
|
||||
{
|
||||
$minimal_quantity = Db::getInstance()->getValue('
|
||||
SELECT `minimal_quantity`
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product_attribute` = '.(int)$id_product_attribute
|
||||
FROM `'._DB_PREFIX_.'product_attribute_shop` pas
|
||||
WHERE `id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND `id_product_attribute` = '.(int)$id_product_attribute
|
||||
);
|
||||
|
||||
if ($minimal_quantity > 1)
|
||||
|
||||
@@ -91,6 +91,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
$attribute_combinations = Db::getInstance()->executeS('
|
||||
SELECT pac.`id_attribute`, pa.`id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||
ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
|
||||
');
|
||||
@@ -98,12 +99,14 @@ class AttributeGroupCore extends ObjectModel
|
||||
foreach ($attribute_combinations as $attribute_combination)
|
||||
if ((int)$attribute_combination['id_attribute'] == 0)
|
||||
$to_remove[] = (int)$attribute_combination['id_product_attribute'];
|
||||
if (!empty($to_remove) && Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product_attribute`
|
||||
IN ('.implode(', ', $to_remove).')') === false)
|
||||
return false;
|
||||
return true;
|
||||
$return = true;
|
||||
if (!empty($to_remove))
|
||||
foreach ($to_remove as $remove)
|
||||
{
|
||||
$combination = new Combination($remove);
|
||||
$return &= $combination->delete();
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
|
||||
+14
-14
@@ -114,7 +114,7 @@ class CarrierCore extends ObjectModel
|
||||
'table' => 'carrier',
|
||||
'primary' => 'id_carrier',
|
||||
'multilang' => true,
|
||||
'multishop' => true,
|
||||
'multilang_shop' => true,
|
||||
'fields' => array(
|
||||
/* Classic fields */
|
||||
'id_reference' => array('type' => self::TYPE_INT),
|
||||
@@ -714,9 +714,9 @@ class CarrierCore extends ObjectModel
|
||||
$where = '`id_carrier` = '.(int)$this->id.' AND (`id_'.$range_table.'` IS NOT NULL OR `id_'.$range_table.'` = 0) ';
|
||||
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$where .= 'AND id_shop IS NULL AND id_group_shop IS NULL';
|
||||
$where .= 'AND id_shop IS NULL AND id_shop_group IS NULL';
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$where .= 'AND id_shop IS NULL AND id_group_shop = '.(int)Shop::getContextGroupShopID();
|
||||
$where .= 'AND id_shop IS NULL AND id_shop_group = '.(int)Shop::getContextShopGroupID();
|
||||
else
|
||||
$where .= 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
|
||||
@@ -737,16 +737,16 @@ class CarrierCore extends ObjectModel
|
||||
$keys = array_keys($price_list[0]);
|
||||
if (!in_array('id_shop', $keys))
|
||||
$keys[] = 'id_shop';
|
||||
if (!in_array('id_group_shop', $keys))
|
||||
$keys[] = 'id_group_shop';
|
||||
if (!in_array('id_shop_group', $keys))
|
||||
$keys[] = 'id_shop_group';
|
||||
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'delivery` ('.implode(', ', $keys).') VALUES ';
|
||||
foreach ($price_list as $values)
|
||||
{
|
||||
if (!isset($values['id_shop']))
|
||||
$values['id_shop'] = (Shop::getContext() == Shop::CONTEXT_SHOP) ? Shop::getContextShopID() : null;
|
||||
if (!isset($values['id_group_shop']))
|
||||
$values['id_group_shop'] = (Shop::getContext() != Shop::CONTEXT_ALL) ? Shop::getContextGroupShopID() : null;
|
||||
if (!isset($values['id_shop_group']))
|
||||
$values['id_shop_group'] = (Shop::getContext() != Shop::CONTEXT_ALL) ? Shop::getContextShopGroupID() : null;
|
||||
|
||||
$sql .= '(';
|
||||
foreach ($values as $v)
|
||||
@@ -805,8 +805,8 @@ class CarrierCore extends ObjectModel
|
||||
$range_weight_id = ($range == 'range_weight') ? $range_id : 'NULL';
|
||||
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'delivery` (`id_carrier`, `id_shop`, `id_group_shop`, `id_range_price`, `id_range_weight`, `id_zone`, `price`) (
|
||||
SELECT '.(int)$this->id.', `id_shop`, `id_group_shop`, '.(int)$range_price_id.', '.(int)$range_weight_id.', `id_zone`, `price`
|
||||
INSERT INTO `'._DB_PREFIX_.'delivery` (`id_carrier`, `id_shop`, `id_shop_group`, `id_range_price`, `id_range_weight`, `id_zone`, `price`) (
|
||||
SELECT '.(int)$this->id.', `id_shop`, `id_shop_group`, '.(int)$range_price_id.', '.(int)$range_weight_id.', `id_zone`, `price`
|
||||
FROM `'._DB_PREFIX_.'delivery`
|
||||
WHERE `id_carrier` = '.(int)$old_id.'
|
||||
AND `id_'.$range.'` = '.(int)$val['id_range'].'
|
||||
@@ -1002,12 +1002,12 @@ class CarrierCore extends ObjectModel
|
||||
public static function sqlDeliveryRangeShop($range_table, $alias = 'd')
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$where = 'AND d2.id_shop IS NULL AND d2.id_group_shop IS NULL';
|
||||
$where = 'AND d2.id_shop IS NULL AND d2.id_shop_group IS NULL';
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$where = 'AND ((d2.id_group_shop IS NULL OR d2.id_group_shop = '.Shop::getContextGroupShopID().') AND d2.id_shop IS NULL)';
|
||||
$where = 'AND ((d2.id_shop_group IS NULL OR d2.id_shop_group = '.Shop::getContextShopGroupID().') AND d2.id_shop IS NULL)';
|
||||
else
|
||||
$where = 'AND (d2.id_shop = '.Shop::getContextShopID().' OR (d2.id_group_shop = '.Shop::getContextGroupShopID().'
|
||||
AND d2.id_shop IS NULL) OR (d2.id_group_shop IS NULL AND d2.id_shop IS NULL))';
|
||||
$where = 'AND (d2.id_shop = '.Shop::getContextShopID().' OR (d2.id_shop_group = '.Shop::getContextShopGroupID().'
|
||||
AND d2.id_shop IS NULL) OR (d2.id_shop_group IS NULL AND d2.id_shop IS NULL))';
|
||||
|
||||
$sql = 'AND '.$alias.'.id_delivery = (
|
||||
SELECT d2.id_delivery
|
||||
@@ -1016,7 +1016,7 @@ class CarrierCore extends ObjectModel
|
||||
AND d2.id_zone = '.$alias.'.id_zone
|
||||
AND d2.id_'.$range_table.' = '.$alias.'.id_'.$range_table.'
|
||||
'.$where.'
|
||||
ORDER BY d2.id_shop DESC, d2.id_group_shop DESC
|
||||
ORDER BY d2.id_shop DESC, d2.id_shop_group DESC
|
||||
LIMIT 1
|
||||
)';
|
||||
return $sql;
|
||||
|
||||
+17
-22
@@ -29,7 +29,7 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
|
||||
public $id_shop;
|
||||
|
||||
@@ -98,7 +98,7 @@ class CartCore extends ObjectModel
|
||||
'table' => 'cart',
|
||||
'primary' => 'id_cart',
|
||||
'fields' => array(
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_address_delivery' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_address_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
@@ -385,27 +385,26 @@ class CartCore extends ObjectModel
|
||||
|
||||
// Build SELECT
|
||||
$sql->select('cp.`id_product_attribute`, cp.`id_product`, cp.`quantity` AS cart_quantity, cp.id_shop, pl.`name`, p.`is_virtual`,
|
||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, p.`id_product`, ps.`id_category_default`, p.`id_supplier`,
|
||||
p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`, p.`price`, p.`weight`,
|
||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, p.`id_product`, product_shop.`id_category_default`, p.`id_supplier`,
|
||||
p.`id_manufacturer`, product_shop.`on_sale`, product_shop.`ecotax`, product_shop.`additional_shipping_cost`, product_shop.`available_for_order`, product_shop.`price`, p.`weight`,
|
||||
stock.`quantity` quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`active`, p.`date_add`,
|
||||
p.`date_upd`, t.`id_tax`, tl.`name` AS tax, t.`rate`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
||||
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery, p.`wholesale_price`,
|
||||
p.advanced_stock_management');
|
||||
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery,
|
||||
product_shop.`wholesale_price`, product_shop.advanced_stock_management');
|
||||
|
||||
// Build FROM
|
||||
$sql->from('cart_product', 'cp');
|
||||
|
||||
// Build JOIN
|
||||
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
||||
$sql->leftJoin('product_lang', 'pl', '
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$this->id_lang.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', '
|
||||
ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
product_shop.`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'
|
||||
@@ -415,12 +414,9 @@ class CartCore extends ObjectModel
|
||||
t.`id_tax` = tl.`id_tax`
|
||||
AND tl.`id_lang` = '.(int)$this->id_lang
|
||||
);
|
||||
$sql->leftJoin('product_shop', 'ps', '
|
||||
ps.`id_product` = p.`id_product`
|
||||
AND ps.`id_shop` = '.(int)Context::getContext()->shop->id
|
||||
);
|
||||
|
||||
$sql->leftJoin('category_lang', 'cl', '
|
||||
ps.`id_category_default` = cl.`id_category`
|
||||
product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('cl')
|
||||
);
|
||||
|
||||
@@ -432,7 +428,6 @@ class CartCore extends ObjectModel
|
||||
if ($id_product)
|
||||
$sql->where('cp.`id_product` = '.(int)$id_product);
|
||||
$sql->where('p.`id_product` IS NOT NULL');
|
||||
$sql->where('ps.`id_shop` = '.(int)Context::getContext()->shop->id);
|
||||
|
||||
// Build GROUP BY
|
||||
$sql->groupBy('unique_id');
|
||||
@@ -450,26 +445,26 @@ class CartCore extends ObjectModel
|
||||
|
||||
if (Combination::isFeatureActive())
|
||||
{
|
||||
$sql->select(
|
||||
'pa.`price` AS price_attribute, pa.`ecotax` AS ecotax_attr,
|
||||
$sql->select('
|
||||
product_attribute_shop.`price` AS price_attribute, product_attribute_shop.`ecotax` AS ecotax_attr,
|
||||
IF (IFNULL(pa.`reference`, \'\') = \'\', p.`reference`, pa.`reference`) AS reference,
|
||||
IF (IFNULL(pa.`supplier_reference`, \'\') = \'\', p.`supplier_reference`, pa.`supplier_reference`) AS supplier_reference,
|
||||
(p.`weight`+ pa.`weight`) weight_attribute,
|
||||
IF (IFNULL(pa.`ean13`, \'\') = \'\', p.`ean13`, pa.`ean13`) AS ean13,
|
||||
IF (IFNULL(pa.`upc`, \'\') = \'\', p.`upc`, pa.`upc`) AS upc,
|
||||
pai.`id_image` as pai_id_image, il.`legend` as pai_legend,
|
||||
IFNULL(pa.`minimal_quantity`, p.`minimal_quantity`) as minimal_quantity,
|
||||
pa.`ecotax` AS ecotax_attr'
|
||||
);
|
||||
IFNULL(product_attribute_shop.`minimal_quantity`, product_shop.`minimal_quantity`) as minimal_quantity
|
||||
');
|
||||
|
||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product_attribute` = cp.`id_product_attribute`');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa'));
|
||||
$sql->leftJoin('product_attribute_image', 'pai', 'pai.`id_product_attribute` = pa.`id_product_attribute`');
|
||||
$sql->leftJoin('image_lang', 'il', 'il.id_image = pai.id_image AND il.id_lang = '.(int)$this->id_lang);
|
||||
}
|
||||
else
|
||||
$sql->select(
|
||||
'p.`reference` AS reference, p.`supplier_reference` AS supplier_reference, p.`ean13`,
|
||||
p.`upc` AS upc, p.`minimal_quantity` AS minimal_quantity'
|
||||
p.`upc` AS upc, product_shop.`minimal_quantity` AS minimal_quantity'
|
||||
);
|
||||
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
@@ -2756,7 +2751,7 @@ class CartCore extends ObjectModel
|
||||
$cart = new Cart($this->id);
|
||||
$cart->id = null;
|
||||
$cart->id_shop = $this->id_shop;
|
||||
$cart->id_group_shop = $this->id_group_shop;
|
||||
$cart->id_shop_group = $this->id_shop_group;
|
||||
$cart->add();
|
||||
|
||||
if (!Validate::isLoadedObject($cart))
|
||||
|
||||
+18
-18
@@ -94,7 +94,7 @@ class CategoryCore extends ObjectModel
|
||||
'table' => 'category',
|
||||
'primary' => 'id_category',
|
||||
'multilang' => true,
|
||||
'multishop' => true,
|
||||
'multilang_shop' => true,
|
||||
'fields' => array(
|
||||
'nleft' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'nright' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
@@ -629,28 +629,29 @@ class CategoryCore extends ObjectModel
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
|
||||
WHERE cp.`id_category` = '.(int)$this->id.
|
||||
($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').
|
||||
($active ? ' AND p.`active` = 1' : '').
|
||||
($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').
|
||||
($active ? ' AND product_shop.`active` = 1' : '').
|
||||
($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '');
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`,
|
||||
il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
|
||||
DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),
|
||||
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).'
|
||||
DAY)) > 0 AS new,
|
||||
(p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice
|
||||
(product_shop.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON p.`id_product` = cp.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
||||
ON (p.`id_product` = pa.`id_product` AND default_on = 1)
|
||||
ON (p.`id_product` = pa.`id_product`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
'.Product::sqlStock('p', 'pa', false, $context->shop).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON (asso_shop_product.`id_category_default` = cl.`id_category`
|
||||
ON (product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (p.`id_product` = pl.`id_product`
|
||||
@@ -661,10 +662,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 (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0)
|
||||
@@ -675,12 +674,14 @@ class CategoryCore extends ObjectModel
|
||||
AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
|
||||
ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
WHERE asso_shop_product.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND cp.`id_category` = '.(int)$this->id
|
||||
.($active ? ' AND p.`active` = 1' : '')
|
||||
.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '')
|
||||
WHERE product_shop.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND product_attribute_shop.default_on = 1
|
||||
AND cp.`id_category` = '.(int)$this->id
|
||||
.($active ? ' AND product_shop.`active` = 1' : '')
|
||||
.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
|
||||
.($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '');
|
||||
|
||||
$sql .= 'GROUP BY p.`id_product`';
|
||||
if ($random === true)
|
||||
{
|
||||
$sql .= ' ORDER BY RAND()';
|
||||
@@ -747,15 +748,14 @@ class CategoryCore extends ObjectModel
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
$query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, asso_shop_category.`id_shop`
|
||||
$query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, category_shop.`id_shop`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
|
||||
'.Shop::addSqlAssociation('category', 'c').'
|
||||
WHERE `id_lang` = '.(int)$id_lang.'
|
||||
AND c.`id_parent` = '.(int)$id_parent.'
|
||||
'.(($id_shop != false) ? 'AND asso_shop_category.`id_shop` = '.(int)$id_shop : '').'
|
||||
'.($active ? 'AND `active` = 1' : '').'
|
||||
ORDER BY asso_shop_category.`position` ASC';
|
||||
ORDER BY category_shop.`position` ASC';
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
}
|
||||
|
||||
+37
-12
@@ -43,6 +43,8 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
public $price;
|
||||
|
||||
public $unit_price_impact;
|
||||
|
||||
public $ecotax;
|
||||
|
||||
public $minimal_quantity = 1;
|
||||
@@ -61,21 +63,25 @@ class CombinationCore extends ObjectModel
|
||||
public static $definition = array(
|
||||
'table' => 'product_attribute',
|
||||
'primary' => 'id_product_attribute',
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'location' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
|
||||
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),
|
||||
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),
|
||||
'wholesale_price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'size' => 27),
|
||||
'price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'size' => 20),
|
||||
'ecotax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'size' => 20),
|
||||
'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'size' => 10),
|
||||
'weight' => array('type' => self::TYPE_INT, 'validate' => 'isFloat'),
|
||||
'minimal_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'default_on' => array('type' => self::TYPE_INT, 'validate' => 'isBool'),
|
||||
'available_date' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'),
|
||||
'reference' => array('type' => self::TYPE_STRING, 'size' => 32),
|
||||
'supplier_reference' => array('type' => self::TYPE_STRING, 'size' => 32),
|
||||
|
||||
/* Shop fields */
|
||||
'wholesale_price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'size' => 27),
|
||||
'price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isNegativePrice', 'size' => 20),
|
||||
'ecotax' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'size' => 20),
|
||||
'unit_price_impact' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'size' => 20),
|
||||
'minimal_quantity' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'default_on' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isBool'),
|
||||
'available_date' => array('type' => self::TYPE_DATE, 'shop' => true, 'validate' => 'isDateFormat'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -93,18 +99,20 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!parent::delete() || $this->deleteAssociations() === false)
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
|
||||
if (!$this->hasMultishopEntries() && !$this->deleteAssociations())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
if (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.(int)$this->id) === false)
|
||||
return false;
|
||||
return true;
|
||||
$result = Db::getInstance()->delete('product_attribute_combination', '`id_product_attribute` = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->delete('cart_product', '`id_product_attribute` = '.(int)$this->id);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function setAttributes($ids_attribute)
|
||||
@@ -227,4 +235,21 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive the price of combination
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param int $id_product_attribute
|
||||
* @return float mixed
|
||||
*/
|
||||
public static function getPrice($id_product_attribute)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT product_attribute_shop.`price`
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE pa.`id_product_attribute` = '.(int)$id_product_attribute
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+32
-32
@@ -32,7 +32,7 @@ class ConfigurationCore extends ObjectModel
|
||||
/** @var string Key */
|
||||
public $name;
|
||||
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
public $id_shop;
|
||||
|
||||
/** @var string Value */
|
||||
@@ -53,7 +53,7 @@ class ConfigurationCore extends ObjectModel
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isConfigName', 'required' => true, 'size' => 32),
|
||||
'id_group_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
|
||||
'id_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
|
||||
'value' => array('type' => self::TYPE_STRING),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
@@ -107,7 +107,7 @@ class ConfigurationCore extends ObjectModel
|
||||
public static function loadConfiguration()
|
||||
{
|
||||
self::$_CONF = array();
|
||||
$sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_group_shop, c.id_shop
|
||||
$sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_shop_group, c.id_shop
|
||||
FROM `'._DB_PREFIX_.'configuration` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'configuration_lang` cl ON (c.id_configuration = cl.id_configuration)';
|
||||
if (!$results = Db::getInstance()->executeS($sql))
|
||||
@@ -126,8 +126,8 @@ class ConfigurationCore extends ObjectModel
|
||||
|
||||
if ($row['id_shop'])
|
||||
self::$_CONF[$lang]['shop'][$row['id_shop']][$row['name']] = $row['value'];
|
||||
else if ($row['id_group_shop'])
|
||||
self::$_CONF[$lang]['group'][$row['id_group_shop']][$row['name']] = $row['value'];
|
||||
else if ($row['id_shop_group'])
|
||||
self::$_CONF[$lang]['group'][$row['id_shop_group']][$row['name']] = $row['value'];
|
||||
else
|
||||
self::$_CONF[$lang]['global'][$row['name']] = $row['value'];
|
||||
}
|
||||
@@ -173,12 +173,12 @@ class ConfigurationCore extends ObjectModel
|
||||
* @param int $shopID
|
||||
* @return array Values in multiple languages
|
||||
*/
|
||||
public static function getInt($key, $id_group_shop = null, $id_shop = null)
|
||||
public static function getInt($key, $id_shop_group = null, $id_shop = null)
|
||||
{
|
||||
$languages = Language::getLanguages();
|
||||
$resultsArray = array();
|
||||
foreach ($languages as $language)
|
||||
$resultsArray[$language['id_lang']] = Configuration::get($key, $language['id_lang'], $id_group_shop, $id_shop);
|
||||
$resultsArray[$language['id_lang']] = Configuration::get($key, $language['id_lang'], $id_shop_group, $id_shop);
|
||||
return $resultsArray;
|
||||
}
|
||||
|
||||
@@ -230,11 +230,11 @@ class ConfigurationCore extends ObjectModel
|
||||
* @param int $shopGroupID
|
||||
* @param int $shopID
|
||||
*/
|
||||
public static function set($key, $values, $id_group_shop = null, $id_shop = null)
|
||||
public static function set($key, $values, $id_shop_group = null, $id_shop = null)
|
||||
{
|
||||
if (!Validate::isConfigName($key))
|
||||
die(Tools::displayError());
|
||||
Configuration::getShopFromContext($id_group_shop, $id_shop);
|
||||
Configuration::getShopFromContext($id_shop_group, $id_shop);
|
||||
|
||||
if (!is_array($values))
|
||||
$values = array($values);
|
||||
@@ -243,8 +243,8 @@ class ConfigurationCore extends ObjectModel
|
||||
{
|
||||
if ($id_shop)
|
||||
self::$_CONF[$lang]['shop'][$id_shop][$key] = $value;
|
||||
else if ($id_group_shop)
|
||||
self::$_CONF[$lang]['group'][$id_group_shop][$key] = $value;
|
||||
else if ($id_shop_group)
|
||||
self::$_CONF[$lang]['group'][$id_shop_group][$key] = $value;
|
||||
else
|
||||
self::$_CONF[$lang]['global'][$key] = $value;
|
||||
}
|
||||
@@ -325,7 +325,7 @@ class ConfigurationCore extends ObjectModel
|
||||
if ($shopID)
|
||||
$newConfig->id_shop = (int)$shopID;
|
||||
if ($shopGroupID)
|
||||
$newConfig->id_group_shop = (int)$shopGroupID;
|
||||
$newConfig->id_shop_group = (int)$shopGroupID;
|
||||
if (!$lang)
|
||||
$newConfig->value = $value;
|
||||
$result &= $newConfig->add(true, true);
|
||||
@@ -382,22 +382,22 @@ class ConfigurationCore extends ObjectModel
|
||||
public static function deleteFromContext($key)
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$id_shop = $id_group_shop = null;
|
||||
$id_shop = $id_shop_group = null;
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
$id_group_shop = Shop::getContextGroupShopID();
|
||||
$id_shop_group = Shop::getContextShopGroupID();
|
||||
$id_shop = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_group_shop = Shop::getContextGroupShopID();
|
||||
$id_shop_group = Shop::getContextShopGroupID();
|
||||
$id_shop = Shop::getContextShopID();
|
||||
}
|
||||
|
||||
if (!$id_shop && !$id_group_shop)
|
||||
if (!$id_shop && !$id_shop_group)
|
||||
return;
|
||||
|
||||
$id = Configuration::getIdByName($key, $id_group_shop, $id_shop);
|
||||
$id = Configuration::getIdByName($key, $id_shop_group, $id_shop);
|
||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration
|
||||
WHERE id_configuration = '.$id;
|
||||
Db::getInstance()->execute($sql);
|
||||
@@ -417,21 +417,21 @@ class ConfigurationCore extends ObjectModel
|
||||
public static function hasContext($key, $id_lang, $context)
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$id_shop = $id_group_shop = null;
|
||||
$id_shop = $id_shop_group = null;
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
$id_group_shop = Shop::getContextGroupShopID();
|
||||
$id_shop_group = Shop::getContextShopGroupID();
|
||||
$id_shop = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_group_shop = Shop::getContextGroupShopID();
|
||||
$id_shop_group = Shop::getContextShopGroupID();
|
||||
$id_shop = Shop::getContextShopID();
|
||||
}
|
||||
|
||||
if ($context == Shop::CONTEXT_SHOP && Configuration::hasKey($key, $id_lang, null, $id_shop))
|
||||
return true;
|
||||
else if ($context == Shop::CONTEXT_GROUP && Configuration::hasKey($key, $id_lang, $id_group_shop))
|
||||
else if ($context == Shop::CONTEXT_GROUP && Configuration::hasKey($key, $id_lang, $id_shop_group))
|
||||
return true;
|
||||
else if ($context == Shop::CONTEXT_ALL && Configuration::hasKey($key, $id_lang))
|
||||
return true;
|
||||
@@ -469,36 +469,36 @@ class ConfigurationCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill $id_group_shop and $id_shop vars from correct context
|
||||
* Fill $id_shop_group and $id_shop vars from correct context
|
||||
*
|
||||
* @param int $id_group_shop
|
||||
* @param int $id_shop_group
|
||||
* @param int $id_shop
|
||||
*/
|
||||
protected static function getShopFromContext(&$id_group_shop, &$id_shop)
|
||||
protected static function getShopFromContext(&$id_shop_group, &$id_shop)
|
||||
{
|
||||
if (!Shop::isFeatureActive())
|
||||
return;
|
||||
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$shop_id = $group_shop_id = null;
|
||||
$shop_id = $shop_group_id = null;
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
$group_shop_id = Shop::getContextGroupShopID();
|
||||
$shop_group_id = Shop::getContextShopGroupID();
|
||||
$shop_id = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_shop_id = Shop::getContextGroupShopID();
|
||||
$shop_group_id = Shop::getContextShopGroupID();
|
||||
$shop_id = Shop::getContextShopID();
|
||||
}
|
||||
|
||||
if (is_null($id_shop))
|
||||
$id_shop = $shop_id;
|
||||
if (is_null($id_group_shop))
|
||||
$id_group_shop = $group_shop_id;
|
||||
if (is_null($id_shop_group))
|
||||
$id_shop_group = $shop_group_id;
|
||||
|
||||
$id_shop = (int)$id_shop;
|
||||
$id_group_shop = (int)$id_group_shop;
|
||||
$id_shop_group = (int)$id_shop_group;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -513,9 +513,9 @@ class ConfigurationCore extends ObjectModel
|
||||
if ($shopID)
|
||||
return ' AND id_shop = '.$shopID;
|
||||
else if ($shopGroupID)
|
||||
return ' AND id_group_shop = '.$shopGroupID.' AND id_shop IS NULL';
|
||||
return ' AND id_shop_group = '.$shopGroupID.' AND id_shop IS NULL';
|
||||
else
|
||||
return ' AND id_group_shop IS NULL AND id_shop IS NULL';
|
||||
return ' AND id_shop_group IS NULL AND id_shop IS NULL';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ class ConnectionCore extends ObjectModel
|
||||
public $id_shop;
|
||||
|
||||
/** @var int */
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
|
||||
/** @var string */
|
||||
public $date_add;
|
||||
@@ -60,7 +60,7 @@ class ConnectionCore extends ObjectModel
|
||||
'ip_address' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'http_referer' => array('type' => self::TYPE_STRING, 'validate' => 'isAbsoluteUrl'),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate')
|
||||
),
|
||||
);
|
||||
@@ -73,8 +73,8 @@ class ConnectionCore extends ObjectModel
|
||||
{
|
||||
if (!$this->id_shop)
|
||||
$this->id_shop = Context::getContext()->shop->id;
|
||||
if (!$this->id_group_shop)
|
||||
$this->id_group_shop = Context::getContext()->shop->id_group_shop;
|
||||
if (!$this->id_shop_group)
|
||||
$this->id_shop_group = Context::getContext()->shop->id_shop_group;
|
||||
|
||||
$fields = parent::getFields();
|
||||
return $fields;
|
||||
@@ -145,7 +145,7 @@ class ConnectionCore extends ObjectModel
|
||||
$connection->id_page = Page::getCurrentId();
|
||||
$connection->ip_address = Tools::getRemoteAddr() ? ip2long(Tools::getRemoteAddr()) : '';
|
||||
$connection->id_shop = Context::getContext()->shop->id;
|
||||
$connection->id_group_shop = Context::getContext()->shop->id_group_shop;
|
||||
$connection->id_shop_group = Context::getContext()->shop->id_shop_group;
|
||||
$connection->date_add = $cookie->date_add;
|
||||
if (Validate::isAbsoluteUrl($referer))
|
||||
$connection->http_referer = $referer;
|
||||
|
||||
@@ -65,7 +65,7 @@ class CurrencyCore extends ObjectModel
|
||||
public static $definition = array(
|
||||
'table' => 'currency',
|
||||
'primary' => 'id_currency',
|
||||
'multishop' => true,
|
||||
'multilang_shop' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
|
||||
'iso_code' => array('type' => self::TYPE_STRING, 'validate' => 'isLanguageIsoCode', 'required' => true, 'size' => 3),
|
||||
|
||||
@@ -31,7 +31,7 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public $id_shop;
|
||||
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
|
||||
/** @var string Secure key */
|
||||
public $secure_key;
|
||||
@@ -183,7 +183,7 @@ class CustomerCore extends ObjectModel
|
||||
'note' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false),
|
||||
'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
|
||||
'id_default_group' => array('type' => self::TYPE_INT, 'copy_post' => false),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
@@ -197,7 +197,7 @@ class CustomerCore extends ObjectModel
|
||||
public function add($autodate = true, $null_values = true)
|
||||
{
|
||||
$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->id;
|
||||
$this->id_group_shop = ($this->id_group_shop) ? $this->id_group_shop : Context::getContext()->shop->id_group_shop;
|
||||
$this->id_shop_group = ($this->id_shop_group) ? $this->id_shop_group : Context::getContext()->shop->id_shop_group;
|
||||
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
||||
$this->secure_key = md5(uniqid(rand(), true));
|
||||
$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
|
||||
|
||||
@@ -34,7 +34,7 @@ class DeliveryCore extends ObjectModel
|
||||
public $id_shop;
|
||||
|
||||
/** @var int **/
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
|
||||
/** @var integer */
|
||||
public $id_carrier;
|
||||
@@ -63,7 +63,7 @@ class DeliveryCore extends ObjectModel
|
||||
'id_range_weight' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_zone' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_shop' => array('type' => self::TYPE_INT),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT),
|
||||
'price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
|
||||
),
|
||||
);
|
||||
@@ -88,10 +88,10 @@ class DeliveryCore extends ObjectModel
|
||||
else
|
||||
$fields['id_shop'] = null;
|
||||
|
||||
if ($this->id_group_shop)
|
||||
$fields['id_group_shop'] = (int)$this->id_group_shop;
|
||||
if ($this->id_shop_group)
|
||||
$fields['id_shop_group'] = (int)$this->id_shop_group;
|
||||
else
|
||||
$fields['id_group_shop'] = null;
|
||||
$fields['id_shop_group'] = null;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -270,9 +270,9 @@ class EmployeeCore extends ObjectModel
|
||||
break;
|
||||
|
||||
case Shop::CONTEXT_GROUP:
|
||||
if ($context->shop->checkIfGroupShopExist(Shop::getContextGroupShopID()))
|
||||
if ($context->shop->checkIfShopGroupExist(Shop::getContextShopGroupID()))
|
||||
{
|
||||
$shops = $context->shop->getIdShopsByIdGroupShop(Shop::getContextGroupShopID());
|
||||
$shops = $context->shop->getIdShopsByIdShopGroup(Shop::getContextShopGroupID());
|
||||
foreach ($shops as $shop)
|
||||
if (!in_array($shop, Employee::getEmployeeShopById($id_employee)))
|
||||
return false;
|
||||
|
||||
+21
-20
@@ -165,25 +165,24 @@ class ManufacturerCore extends ObjectModel
|
||||
* @return array Manufacturers
|
||||
*/
|
||||
public static function getManufacturers($get_nb_products = false, $id_lang = 0, $active = true, $p = false,
|
||||
$n = false, $all_group = false, $id_group_shop = false)
|
||||
$n = false, $all_group = false, $id_shop_group = false)
|
||||
{
|
||||
if (!$id_lang)
|
||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
if (!$id_group_shop)
|
||||
if (!$id_shop_group)
|
||||
if (Context::getContext()->shop->id)
|
||||
$id_group_shop = Shop::getGroupFromShop(Context::getContext()->shop->id);
|
||||
$id_shop_group = Shop::getGroupFromShop(Context::getContext()->shop->id);
|
||||
else
|
||||
$id_group_shop = Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
$id_shop_group = Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
|
||||
$sql = 'SELECT m.*, ml.`description`
|
||||
FROM `'._DB_PREFIX_.'manufacturer_group_shop` mgs
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.id_manufacturer = mgs.id_manufacturer)
|
||||
FROM `'._DB_PREFIX_.'manufacturer` m
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer_lang` ml ON (
|
||||
m.`id_manufacturer` = ml.`id_manufacturer`
|
||||
AND ml.`id_lang` = '.(int)$id_lang.'
|
||||
)
|
||||
WHERE mgs.id_group_shop='.(int)$id_group_shop.
|
||||
'.Shop::addSqlAssociation('manufacturer', 'm').
|
||||
($active ? ' AND m.`active` = 1' : '').'
|
||||
ORDER BY m.`name` ASC'.
|
||||
($p ? ' LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n : '');
|
||||
@@ -206,9 +205,10 @@ class ManufacturerCore extends ObjectModel
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||
'SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` as m ON (m.`id_manufacturer`= p.`id_manufacturer`)
|
||||
WHERE m.`id_manufacturer` = '.(int)$manufacturer['id_manufacturer'].
|
||||
($active ? ' AND p.`active` = 1 ' : '').
|
||||
($active ? ' AND product_shop.`active` = 1 ' : '').
|
||||
($all_group ? '' : ' AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -304,8 +304,8 @@ class ManufacturerCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE p.id_manufacturer = '.(int)$id_manufacturer
|
||||
.($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
.($active ? ' AND product_shop.`active` = 1' : '').'
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -322,31 +322,30 @@ class ManufacturerCore extends ObjectModel
|
||||
$order_by = explode('.', $order_by);
|
||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||
}
|
||||
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
|
||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
|
||||
pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
product_shop.`date_add`,
|
||||
DATE_SUB(
|
||||
NOW(),
|
||||
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY
|
||||
)
|
||||
) > 0 AS new,
|
||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice
|
||||
(product_shop.`price` * ((100 + (t.`rate`))/100)) AS orderprice
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
||||
ON (p.`id_product` = pa.`id_product` AND default_on = 1)
|
||||
ON (p.`id_product` = pa.`id_product`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('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_.'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`
|
||||
ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0)
|
||||
@@ -358,8 +357,9 @@ class ManufacturerCore extends ObjectModel
|
||||
ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.`id_manufacturer` = '.(int)$id_manufacturer.'
|
||||
'.($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
'.($active ? ' AND product_shop.`active` = 1' : '').'
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND product_attribute_shop.`default_on` = 1
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -392,12 +392,13 @@ class ManufacturerCore extends ObjectModel
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('procut', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
WHERE p.`id_manufacturer` = '.(int)$this->id.
|
||||
($front ? ' AND p.`visibility` IN ("both", "catalog")' : ''));
|
||||
($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : ''));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class MetaCore extends ObjectModel
|
||||
'table' => 'meta',
|
||||
'primary' => 'id_meta',
|
||||
'multilang' => true,
|
||||
'multishop' => true,
|
||||
'multilang_shop' => true,
|
||||
'fields' => array(
|
||||
'page' => array('type' => self::TYPE_STRING, 'validate' => 'isFileName', 'required' => true, 'size' => 64),
|
||||
|
||||
|
||||
+199
-65
@@ -38,6 +38,13 @@ abstract class ObjectModelCore
|
||||
const TYPE_HTML = 6;
|
||||
const TYPE_NOTHING = 7;
|
||||
|
||||
/**
|
||||
* List of data to format
|
||||
*/
|
||||
const FORMAT_COMMON = 1;
|
||||
const FORMAT_LANG = 2;
|
||||
const FORMAT_SHOP = 3;
|
||||
|
||||
/**
|
||||
* List of association types
|
||||
*/
|
||||
@@ -121,6 +128,11 @@ abstract class ObjectModelCore
|
||||
*/
|
||||
protected $def;
|
||||
|
||||
/**
|
||||
* @var array List of specific fields to update (all fields if null)
|
||||
*/
|
||||
protected $update_fields = null;
|
||||
|
||||
/**
|
||||
* Returns object validation rules (fields validity)
|
||||
*
|
||||
@@ -155,13 +167,13 @@ abstract class ObjectModelCore
|
||||
if (!is_null($id_lang))
|
||||
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
if ($id_shop && $this->isLangMultishop())
|
||||
if ($id_shop && $this->isMultishop())
|
||||
{
|
||||
$this->id_shop = (int)$id_shop;
|
||||
$this->get_shop_from_context = false;
|
||||
}
|
||||
|
||||
if ($this->isLangMultishop() && !$this->id_shop)
|
||||
if ($this->isMultishop() && !$this->id_shop)
|
||||
$this->id_shop = Context::getContext()->shop->id;
|
||||
|
||||
if (!Validate::isTableOrIdentifier($this->def['primary']) || !Validate::isTableOrIdentifier($this->def['table']))
|
||||
@@ -176,12 +188,19 @@ abstract class ObjectModelCore
|
||||
$sql = new DbQuery();
|
||||
$sql->from($this->def['table'], 'a');
|
||||
$sql->where('a.'.$this->def['primary'].' = '.(int)$id);
|
||||
|
||||
// Get lang informations
|
||||
if ($id_lang)
|
||||
{
|
||||
$sql->leftJoin($this->def['table'].'_lang', 'b', 'a.'.$this->def['primary'].' = b.'.$this->def['primary'].' AND b.id_lang = '.(int)$id_lang);
|
||||
if ($this->id_shop)
|
||||
$sql->where('b.id_shop = '.$this->id_shop);
|
||||
}
|
||||
|
||||
// Get shop informations
|
||||
if (!empty($this->def['multishop']))
|
||||
$sql->leftJoin($this->def['table'].'_shop', 'c', 'a.'.$this->def['primary'].' = c.'.$this->def['primary'].' AND c.id_shop = '.(int)$this->id_shop);
|
||||
|
||||
Cache::store($cache_id, Db::getInstance()->getRow($sql));
|
||||
}
|
||||
|
||||
@@ -234,7 +253,29 @@ abstract class ObjectModelCore
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields = $this->formatFields();
|
||||
$fields = $this->formatFields(self::FORMAT_COMMON);
|
||||
|
||||
// For retro compatibility, get common fields for default shop
|
||||
if ($this->id_shop == Configuration::get('PS_SHOP_DEFAULT'))
|
||||
$fields = array_merge($fields, $this->getFieldsShop());
|
||||
|
||||
// Ensure that we get something to insert
|
||||
if (!$fields)
|
||||
$fields[$this->def['primary']] = $this->id;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare fields for multishop
|
||||
* Fields are not validated here, we considere they are already validated in getFields() method, this
|
||||
* not the best solution but this is the only one possible for retro compatibility.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @return array All object fields
|
||||
*/
|
||||
public function getFieldsShop()
|
||||
{
|
||||
$fields = $this->formatFields(self::FORMAT_SHOP);
|
||||
if (!$fields)
|
||||
$fields[$this->def['primary']] = $this->id;
|
||||
return $fields;
|
||||
@@ -253,23 +294,35 @@ abstract class ObjectModelCore
|
||||
return $this->getTranslationsFieldsChild();
|
||||
|
||||
$this->validateFieldsLang();
|
||||
$is_lang_multishop = $this->isLangMultishop();
|
||||
|
||||
$fields = array();
|
||||
if (is_null($this->id_lang))
|
||||
foreach (Language::getLanguages(false) as $language)
|
||||
$fields[$language['id_lang']] = $this->formatFields($language['id_lang']);
|
||||
{
|
||||
$fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']);
|
||||
$fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
|
||||
if ($this->id_shop && $is_lang_multishop)
|
||||
$fields[$language['id_lang']]['id_shop'] = (int)$this->id_shop;
|
||||
}
|
||||
else
|
||||
$fields = array($this->id_lang => $this->formatFields($this->id_lang));
|
||||
{
|
||||
$fields = array($this->id_lang => $this->formatFields(self::FORMAT_LANG, $this->id_lang));
|
||||
$fields['id_lang'] = $this->id_lang;
|
||||
if ($this->id_shop && $is_lang_multishop)
|
||||
$fields['id_shop'] = (int)$this->id_shop;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @param int $type FORMAT_COMMON or FORMAT_LANG or FORMAT_SHOP
|
||||
* @param int $id_lang If this parameter is given, only take lang fields
|
||||
* @return array
|
||||
*/
|
||||
protected function formatFields($id_lang = null)
|
||||
protected function formatFields($type, $id_lang = null)
|
||||
{
|
||||
$fields = array();
|
||||
|
||||
@@ -277,23 +330,21 @@ abstract class ObjectModelCore
|
||||
if (isset($this->id))
|
||||
$fields[$this->def['primary']] = $this->id;
|
||||
|
||||
// Set id_lang field for multilang fields and id_shop for multishop field
|
||||
if ($id_lang)
|
||||
{
|
||||
$fields['id_lang'] = $id_lang;
|
||||
if ($this->id_shop && $this->isLangMultishop())
|
||||
$fields['id_shop'] = (int)$this->id_shop;
|
||||
}
|
||||
|
||||
foreach ($this->def['fields'] as $field => $data)
|
||||
{
|
||||
// If $id_lang take only language fields, else take only classic fields
|
||||
if (($id_lang && empty($data['lang'])) || (!$id_lang && !empty($data['lang'])))
|
||||
// Only get fields we need for the type
|
||||
// E.g. if only lang fields are filtered, ignore fields without lang => true
|
||||
if (($type == self::FORMAT_LANG && empty($data['lang']))
|
||||
|| ($type == self::FORMAT_SHOP && empty($data['shop']))
|
||||
|| ($type == self::FORMAT_COMMON && (!empty($data['shop']) || !empty($data['lang']))))
|
||||
continue;
|
||||
|
||||
if (is_array($this->update_fields) && (empty($this->update_fields[$field]) || ($type == self::FORMAT_LANG && empty($this->update_fields[$field][$id_lang]))))
|
||||
continue;
|
||||
|
||||
// Get field value, if value is multilang and field is empty, use value from default lang
|
||||
$value = $this->$field;
|
||||
if ($id_lang && is_array($value))
|
||||
if ($type == self::FORMAT_LANG && $id_lang && is_array($value))
|
||||
{
|
||||
if (!empty($value[$id_lang]))
|
||||
$value = $value[$id_lang];
|
||||
@@ -392,10 +443,28 @@ abstract class ObjectModelCore
|
||||
|
||||
// Get object id in database
|
||||
$this->id = Db::getInstance()->Insert_ID();
|
||||
|
||||
// Database insertion for multishop fields related to the object
|
||||
if (!empty($this->def['multishop']))
|
||||
{
|
||||
$fields = $this->getFieldsShop();
|
||||
$fields[$this->def['primary']] = (int)$this->id;
|
||||
$fields['id_shop'] = (int)$this->id_shop;
|
||||
if ($null_values)
|
||||
$result &= Db::getInstance()->insert($this->def['table'].'_shop', $fields, true);
|
||||
else
|
||||
$result &= Db::getInstance()->insert($this->def['table'].'_shop', $fields);
|
||||
}
|
||||
else if (!Shop::isFeatureActive() && Shop::isTableAssociated($this->def['table']))
|
||||
$result &= $this->associateTo(Context::getContext()->shop->id);
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
$assos = Shop::getAssoTables();
|
||||
|
||||
// Database insertion for multilingual fields related to the object
|
||||
if (isset($this->def['multilang']) && $this->def['multilang'])
|
||||
if (!empty($this->def['multilang']))
|
||||
{
|
||||
$fields = $this->getFieldsLang();
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
@@ -420,16 +489,6 @@ abstract class ObjectModelCore
|
||||
}
|
||||
}
|
||||
|
||||
if (!Shop::isFeatureActive())
|
||||
{
|
||||
if (isset($assos[$this->def['table']]) && $assos[$this->def['table']]['type'] == 'shop')
|
||||
$result &= $this->associateTo(Context::getContext()->shop->id, 'shop');
|
||||
|
||||
$assos = GroupShop::getAssoTables();
|
||||
if (isset($assos[$this->def['table']]) && $assos[$this->def['table']]['type'] == 'group_shop')
|
||||
$result &= $this->associateTo(Context::getContext()->shop->id_group_shop, 'group_shop');
|
||||
}
|
||||
|
||||
// @hook actionObject*AddAfter
|
||||
Hook::exec('actionObjectAddAfter', array('object' => $this));
|
||||
Hook::exec('actionObject'.get_class($this).'AddAfter', array('object' => $this));
|
||||
@@ -460,9 +519,26 @@ abstract class ObjectModelCore
|
||||
$result = Db::getInstance()->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, true);
|
||||
else
|
||||
$result = Db::getInstance()->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
// Database insertion for multishop fields related to the object
|
||||
if (!empty($this->def['multishop']))
|
||||
{
|
||||
$fields = $this->getFieldsShop();
|
||||
$fields[$this->def['primary']] = (int)$this->id;
|
||||
foreach (Shop::getContextListShopID() as $id_shop)
|
||||
{
|
||||
$fields['id_shop'] = $id_shop;
|
||||
$where = 'id_product = '.(int)$this->id.' AND id_shop = '.(int)$id_shop;
|
||||
if (Db::getInstance()->getValue('SELECT id_product FROM '._DB_PREFIX_.$this->def['table'].'_shop WHERE '.$where))
|
||||
$result &= Db::getInstance()->update($this->def['table'].'_shop', $fields, $where, 0, $null_values);
|
||||
else
|
||||
$result &= Db::getInstance()->insert($this->def['table'].'_shop', $fields, $null_values);
|
||||
}
|
||||
}
|
||||
|
||||
// Database update for multilingual fields related to the object
|
||||
if (isset($this->def['multilang']) && $this->def['multilang'])
|
||||
{
|
||||
@@ -525,23 +601,25 @@ abstract class ObjectModelCore
|
||||
Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));
|
||||
|
||||
$this->clearCache();
|
||||
$result = true;
|
||||
|
||||
// Remove association to multishop table
|
||||
if (!empty($this->def['multishop']))
|
||||
$result &= Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id.' AND id_shop IN ('.implode(', ', Shop::getContextListShopID()).')');
|
||||
else if (Shop::isTableAssociated($this->def['table']))
|
||||
$result &= Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id);
|
||||
|
||||
// Database deletion
|
||||
$result = Db::getInstance()->delete($this->def['table'], '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||
$has_multishop_entries = !empty($this->def['multishop']) ? $this->hasMultishopEntries() : false;
|
||||
if ($result && !$has_multishop_entries)
|
||||
$result &= Db::getInstance()->delete($this->def['table'], '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
// Database deletion for multilingual fields related to the object
|
||||
if (isset($this->def['multilang']) && $this->def['multilang'])
|
||||
Db::getInstance()->delete($this->def['table'].'_lang', '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||
|
||||
$assos = Shop::getAssoTables();
|
||||
if (isset($assos[$this->def['table']]) && $assos[$this->def['table']]['type'] == 'shop')
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id);
|
||||
|
||||
$assos = GroupShop::getAssoTables();
|
||||
if (isset($assos[$this->def['table']]) && $assos[$this->def['table']]['type'] == 'group_shop')
|
||||
Db::getInstance()->delete($this->def['table'].'_group_shop', '`'.$this->def['primary'].'`='.(int)$this->id);
|
||||
if (!empty($this->def['multilang']) && !$has_multishop_entries)
|
||||
$result &= Db::getInstance()->delete($this->def['table'].'_lang', '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
|
||||
|
||||
// @hook actionObject*DeleteAfter
|
||||
Hook::exec('actionObjectDeleteAfter', array('object' => $this));
|
||||
@@ -653,6 +731,9 @@ abstract class ObjectModelCore
|
||||
if (!empty($data['lang']))
|
||||
continue;
|
||||
|
||||
if (is_array($this->update_fields) && empty($this->update_fields[$field]))
|
||||
continue;
|
||||
|
||||
$message = $this->validateField($field, $this->$field);
|
||||
if ($message !== true)
|
||||
{
|
||||
@@ -685,6 +766,9 @@ abstract class ObjectModelCore
|
||||
|
||||
foreach ($values as $id_lang => $value)
|
||||
{
|
||||
if (is_array($this->update_fields) && empty($this->update_fields[$field][$id_lang]))
|
||||
continue;
|
||||
|
||||
$message = $this->validateField($field, $value, $id_lang);
|
||||
if ($message !== true)
|
||||
{
|
||||
@@ -967,10 +1051,9 @@ abstract class ObjectModelCore
|
||||
* This function associate an item to its context
|
||||
*
|
||||
* @param int|array $id_shops
|
||||
* @param string $type
|
||||
* @return boolean
|
||||
*/
|
||||
public function associateTo($id_shops, $type = 'shop')
|
||||
public function associateTo($id_shops)
|
||||
{
|
||||
if (!$this->id)
|
||||
return;
|
||||
@@ -981,43 +1064,24 @@ abstract class ObjectModelCore
|
||||
$data = array();
|
||||
foreach ($id_shops as $id_shop)
|
||||
{
|
||||
if (($type == 'shop' && !$this->isAssociatedToShop($id_shop)) || ($type == 'group_shop' && !$this->isAssociatedToGroupShop($id_shop)))
|
||||
if (!$this->isAssociatedToShop($id_shop))
|
||||
$data[] = array(
|
||||
$this->def['primary'] => (int)$this->id,
|
||||
'id_'.$type => (int)$id_shop,
|
||||
'id_shop' => (int)$id_shop,
|
||||
);
|
||||
}
|
||||
|
||||
if ($data)
|
||||
return Db::getInstance()->insert($this->def['table'].'_'.$type, $data);
|
||||
return Db::getInstance()->insert($this->def['table'].'_shop', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current object is associated to a group shop
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param int $id_group_shop
|
||||
* @return bool
|
||||
*/
|
||||
public function isAssociatedToGroupShop($id_group_shop = null)
|
||||
{
|
||||
if (is_null($id_group_shop))
|
||||
$id_group_shop = Context::getContext()->shop->id_group_shop;
|
||||
|
||||
$sql = 'SELECT id_group_shop
|
||||
FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_group_shop`
|
||||
WHERE `'.$this->def['primary'].'`='.(int)$this->id.' AND id_group_shop='.(int)$id_group_shop;
|
||||
return (bool)Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function duplicateShops($id)
|
||||
{
|
||||
$asso = Shop::getAssoTables();
|
||||
if (!isset($asso[$this->def['table']]) || $asso[$this->def['table']]['type'] != 'shop')
|
||||
if (!Shop::isTableAssociated($this->def['table']))
|
||||
return false;
|
||||
|
||||
$sql = 'SELECT id_shop
|
||||
@@ -1034,9 +1098,67 @@ abstract class ObjectModelCore
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is entries in associated shop table for current entity
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMultishopEntries()
|
||||
{
|
||||
if (empty($this->def['multishop']))
|
||||
return false;
|
||||
|
||||
return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
public function isMultishop()
|
||||
{
|
||||
return !empty($this->def['multishop']) || !empty($this->def['multilang_shop']);
|
||||
}
|
||||
|
||||
public function isLangMultishop()
|
||||
{
|
||||
return isset($this->def['multishop']) && $this->def['multishop'] && isset($this->def['multilang']) && $this->def['multilang'];
|
||||
return !empty($this->def['multilang']) && !empty($this->def['multilang_shop']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a table and splits the common datas and the shop datas
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param string $classname
|
||||
* @param array $data
|
||||
* @param string $where
|
||||
* @return bool
|
||||
*/
|
||||
public static function updateMultishopTable($classname, $data, $where)
|
||||
{
|
||||
$def = ObjectModel::getDefinition($classname);
|
||||
$common_data = $shop_data = array();
|
||||
$is_default_shop = Context::getContext()->shop->id == Configuration::get('PS_SHOP_DEFAULT');
|
||||
foreach ($data as $field => $value)
|
||||
{
|
||||
if (!isset($def['fields'][$field]))
|
||||
continue;
|
||||
|
||||
if (!empty($def['fields'][$field]['shop']))
|
||||
{
|
||||
if ($is_default_shop)
|
||||
$common_data[$field] = $value;
|
||||
$shop_data[$field] = $value;
|
||||
}
|
||||
else
|
||||
$common_data[$field] = $value;
|
||||
}
|
||||
|
||||
$result = true;
|
||||
if ($common_data)
|
||||
$result &= Db::getInstance()->update($def['table'], $common_data, $where);
|
||||
|
||||
if ($shop_data)
|
||||
$result &= Db::getInstance()->update($def['table'].'_shop', $shop_data, $where.' AND id_shop = '.(int)Context::getContext()->shop->id);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1276,4 +1398,16 @@ abstract class ObjectModelCore
|
||||
else
|
||||
throw new PrestaShopException('Could not load field from definition.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of specific fields to update
|
||||
* array(field1 => true, field2 => false, langfield1 => array(1 => true, 2 => false))
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param array $fields
|
||||
*/
|
||||
public function setFieldsToUpdate(array $fields)
|
||||
{
|
||||
$this->update_fields = $fields;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-12
@@ -126,7 +126,7 @@ class PackCore extends Product
|
||||
if (!Pack::isFeatureActive())
|
||||
return array();
|
||||
|
||||
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, asso_shop_product.`id_category_default`
|
||||
$sql = 'SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, product_shop.`id_category_default`
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
@@ -136,16 +136,14 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON asso_shop_product.`id_category_default` = cl.`id_category`
|
||||
ON product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`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`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE asso_shop_product.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
WHERE product_shop.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND a.`id_product_pack` = '.(int)$id_product;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$full)
|
||||
@@ -172,14 +170,13 @@ class PackCore extends Product
|
||||
return array();
|
||||
|
||||
$sql = '
|
||||
SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`
|
||||
SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
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_.'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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`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`)
|
||||
@@ -202,7 +199,7 @@ class PackCore extends Product
|
||||
|
||||
public static function deleteItems($id_product)
|
||||
{
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 0 WHERE id_product = '.(int)$id_product.' LIMIT 1') &&
|
||||
return Db::getInstance()->update('product', array('cache_is_pack' => 0), 'id_product = '.(int)$id_product) &&
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)$id_product) &&
|
||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', Pack::isCurrentlyUsed());
|
||||
}
|
||||
@@ -217,7 +214,7 @@ class PackCore extends Product
|
||||
*/
|
||||
public static function addItem($id_product, $id_item, $qty)
|
||||
{
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)$id_product.' LIMIT 1') &&
|
||||
return Db::getInstance()->update('product', array('cache_is_pack', 1), 'id_product = '.(int)$id_product) &&
|
||||
Db::getInstance()->insert('pack', array('id_product_pack' => (int)$id_product, 'id_product_item' => (int)$id_item, 'quantity' => (int)$qty)) &&
|
||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', '1');
|
||||
}
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ class PageCore extends ObjectModel
|
||||
'id_page' => (int)$id_page,
|
||||
'counter' => 1,
|
||||
'id_shop' => (int)$context->shop->id,
|
||||
'id_group_shop' => (int)$context->shop->id_group_shop,
|
||||
'id_shop_group' => (int)$context->shop->id_shop_group,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$order->reference = $reference;
|
||||
|
||||
$order->id_shop = (int)(Shop::getContext() == Shop::CONTEXT_SHOP ? $shop->id : $cart->id_shop);
|
||||
$order->id_group_shop = (int)(Shop::getContext() == Shop::CONTEXT_SHOP ? $shop->id_group_shop : $cart->id_group_shop);
|
||||
$order->id_shop_group = (int)(Shop::getContext() == Shop::CONTEXT_SHOP ? $shop->id_shop_group : $cart->id_shop_group);
|
||||
|
||||
$customer = new Customer($order->id_customer);
|
||||
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($customer->secure_key));
|
||||
|
||||
+241
-358
File diff suppressed because it is too large
Load Diff
@@ -128,9 +128,10 @@ class ProductDownloadCore extends ObjectModel
|
||||
|
||||
public function delete($delete = false)
|
||||
{
|
||||
if ($delete)
|
||||
$result = parent::delete();
|
||||
if ($result && $delete)
|
||||
return $this->deleteFile();
|
||||
return true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ class ProductSaleCore
|
||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
WHERE p.`active` = 1';
|
||||
WHERE product_shop.`active` = 1';
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class ProductSaleCore
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
|
||||
|
||||
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
|
||||
@@ -90,14 +90,12 @@ 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_.'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`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`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`)
|
||||
'.Product::sqlStock('p').'
|
||||
WHERE p.`active` = 1
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -145,9 +143,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_.'category_lang` cl
|
||||
ON cl.`id_category` = asso_shop_product.`id_category_default`
|
||||
ON cl.`id_category` = product_shop.`id_category_default`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE p.`active` = 1
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
|
||||
+2
-1
@@ -245,7 +245,8 @@ class SceneCore extends ObjectModel
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'scene_products` s
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = s.id_product)
|
||||
WHERE s.id_scene = '.(int)$this->id.($only_active ? ' AND p.active = 1' : ''));
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE s.id_scene = '.(int)$this->id.($only_active ? ' AND product_shop.active = 1' : ''));
|
||||
|
||||
if (!$lite_result && $products)
|
||||
foreach ($products as &$product)
|
||||
|
||||
+24
-31
@@ -222,9 +222,9 @@ class SearchCore
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
WHERE c.`active` = 1
|
||||
AND p.`active` = 1
|
||||
AND p.`visibility` IN ("both", "search")
|
||||
AND indexed = 1
|
||||
AND product_shop.`active` = 1
|
||||
AND product_shop.`visibility` IN ("both", "search")
|
||||
AND product_shop.indexed = 1
|
||||
AND cg.`id_group` '.(!$id_customer ? '= 1' : 'IN (
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
WHERE id_customer = '.(int)$id_customer.'
|
||||
@@ -266,7 +266,7 @@ class SearchCore
|
||||
)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (
|
||||
asso_shop_product.`id_category_default` = cl.`id_category`
|
||||
product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
)
|
||||
WHERE p.`id_product` '.$product_pool.'
|
||||
@@ -279,7 +279,7 @@ class SearchCore
|
||||
$order_by = explode('.', $order_by);
|
||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||
}
|
||||
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
||||
DATEDIFF(
|
||||
@@ -290,13 +290,12 @@ class SearchCore
|
||||
)
|
||||
) > 0 new
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
@@ -311,13 +310,12 @@ class SearchCore
|
||||
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`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` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
@@ -357,6 +355,7 @@ class SearchCore
|
||||
SELECT al.name FROM '._DB_PREFIX_.'product_attribute pa
|
||||
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
|
||||
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (pac.id_attribute = al.id_attribute AND al.id_lang = '.(int)$id_lang.')
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE pa.id_product = '.(int)$id_product);
|
||||
foreach ($attributesArray as $attribute)
|
||||
$attributes .= $attribute['name'].' ';
|
||||
@@ -391,11 +390,11 @@ class SearchCore
|
||||
ON p.id_product = pl.id_product
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl
|
||||
ON (cl.id_category = asso_shop_product.id_category_default AND pl.id_lang = cl.id_lang)
|
||||
ON (cl.id_category = product_shop.id_category_default AND pl.id_lang = cl.id_lang)
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m
|
||||
ON m.id_manufacturer = p.id_manufacturer
|
||||
WHERE p.indexed = 0
|
||||
AND p.visibility IN ("both", "search")
|
||||
WHERE product_shop.indexed = 0
|
||||
AND product_shop.visibility IN ("both", "search")
|
||||
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
|
||||
LIMIT '.(int)$limit
|
||||
);
|
||||
@@ -412,16 +411,17 @@ class SearchCore
|
||||
{
|
||||
$db->execute('TRUNCATE '._DB_PREFIX_.'search_index');
|
||||
$db->execute('TRUNCATE '._DB_PREFIX_.'search_word');
|
||||
$db->execute('UPDATE '._DB_PREFIX_.'product SET indexed = 0');
|
||||
ObjectModel::updateMultishopTable('Product', array('indexed' => 0), '1');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do it even if you already know the product id in order to be sure that it exists and it needs to be indexed
|
||||
$products = $db->executeS('
|
||||
SELECT id_product
|
||||
FROM '._DB_PREFIX_.'product
|
||||
WHERE visibility IN ("both", "search")
|
||||
AND '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0')
|
||||
SELECT p.id_product
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE product_shop.visibility IN ("both", "search")
|
||||
AND '.($id_product ? 'p.id_product = '.(int)$id_product : 'product_shop.indexed = 0')
|
||||
);
|
||||
|
||||
$ids = array();
|
||||
@@ -574,12 +574,7 @@ class SearchCore
|
||||
protected static function setProductsAsIndexed(&$products)
|
||||
{
|
||||
if (count($products))
|
||||
Db::getInstance()->execute(
|
||||
'UPDATE '._DB_PREFIX_.'product SET indexed = 1
|
||||
WHERE id_product IN ('.implode(',', $products).')
|
||||
LIMIT '.(int)count($products)
|
||||
);
|
||||
$productsArray = array();
|
||||
ObjectModel::updateMultishopTable('Product', array('indexed' => 1), 'id_product IN ('.implode(',', $products).')');
|
||||
}
|
||||
|
||||
/** $queryArray3 is automatically emptied in order to be reused immediatly */
|
||||
@@ -625,7 +620,7 @@ class SearchCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cp.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)
|
||||
WHERE p.`active` = 1
|
||||
WHERE product_shop.`active` = 1
|
||||
AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND cg.`id_group` '.(!$id_customer ? '= 1' : 'IN (
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
@@ -634,7 +629,7 @@ class SearchCore
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
|
||||
$sql = 'SELECT DISTINCT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
|
||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
@@ -651,9 +646,7 @@ class SearchCore
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
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_.'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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
@@ -664,7 +657,7 @@ class SearchCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cg.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.`active` = 1
|
||||
WHERE product_shop.`active` = 1
|
||||
AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND cg.`id_group` '.(!$id_customer ? '= 1' : 'IN (
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
|
||||
@@ -32,7 +32,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
public $id_cart = 0;
|
||||
public $id_product_attribute;
|
||||
public $id_shop;
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
public $id_currency;
|
||||
public $id_country;
|
||||
public $id_group;
|
||||
@@ -51,7 +51,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
'table' => 'specific_price',
|
||||
'primary' => 'id_specific_price',
|
||||
'fields' => array(
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
@@ -74,7 +74,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
'objectsNodeName' => 'specific_prices',
|
||||
'objectNodeName' => 'specific_price',
|
||||
'fields' => array(
|
||||
'id_group_shop' => array('xlink_resource' => 'shop_groups'),
|
||||
'id_shop_group' => array('xlink_resource' => 'shop_groups'),
|
||||
'id_shop' => array('xlink_resource' => 'shops', 'required' => true),
|
||||
'id_cart' => array('xlink_resource' => 'carts', 'required' => true),
|
||||
'id_product' => array('xlink_resource' => 'products', 'required' => true),
|
||||
|
||||
@@ -172,6 +172,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
$query = new DbQuery();
|
||||
$query->select('p.id_product');
|
||||
$query->from('product', 'p');
|
||||
$query->join(Shop::addSqlAssociation('product', 'p'));
|
||||
$query->groupBy('p.id_product');
|
||||
|
||||
$attributes = false;
|
||||
@@ -221,11 +222,12 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
{
|
||||
$query->select('pa.id_product_attribute');
|
||||
$query->leftJoin('product_attribute', 'pa', 'p.id_product = pa.id_product');
|
||||
$query->join(Shop::addSqlAssociation('product_attribute', 'pa'));
|
||||
$query->leftJoin('product_attribute_combination', 'pac', 'pa.id_product_attribute = pac.id_product_attribute');
|
||||
$query->groupBy('pa.id_product_attribute');
|
||||
}
|
||||
else
|
||||
$query->select('NULL id_product_attribute');
|
||||
$query->select('NULL as id_product_attribute');
|
||||
|
||||
if ($features)
|
||||
$query->leftJoin('feature_product', 'fp', 'p.id_product = fp.id_product');
|
||||
|
||||
+12
-10
@@ -131,9 +131,10 @@ class SupplierCore extends ObjectModel
|
||||
SELECT DISTINCT(ps.`id_product`)
|
||||
FROM `'._DB_PREFIX_.'product_supplier` ps
|
||||
JOIN `'._DB_PREFIX_.'product` p ON (ps.`id_product`= p.`id_product`)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE ps.`id_supplier` = '.(int)$supplier['id_supplier'].'
|
||||
AND ps.id_product_attribute = 0'.
|
||||
($active ? ' AND p.`active` = 1' : '').
|
||||
($active ? ' AND product_shop.`active` = 1' : '').
|
||||
($all_groups ? '' :'
|
||||
AND ps.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
@@ -209,10 +210,11 @@ class SupplierCore extends ObjectModel
|
||||
SELECT DISTINCT(ps.`id_product`)
|
||||
FROM `'._DB_PREFIX_.'product_supplier` ps
|
||||
JOIN `'._DB_PREFIX_.'product` p ON (ps.`id_product`= p.`id_product`)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE ps.`id_supplier` = '.(int)$id_supplier.'
|
||||
AND ps.id_product_attribute = 0'.
|
||||
($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
($active ? ' AND product_shop.`active` = 1' : '').'
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -231,7 +233,7 @@ class SupplierCore extends ObjectModel
|
||||
$order_by = explode('.', $order_by);
|
||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||
}
|
||||
$sql = 'SELECT p.*, stock.out_of_stock,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock,
|
||||
IFNULL(stock.quantity, 0) as quantity,
|
||||
pl.`description`,
|
||||
pl.`description_short`,
|
||||
@@ -249,6 +251,7 @@ class SupplierCore extends ObjectModel
|
||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice,
|
||||
m.`name` AS manufacturer_name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
JOIN `'._DB_PREFIX_.'product_supplier` ps ON (ps.id_product = p.id_product
|
||||
AND ps.id_product_attribute = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`
|
||||
@@ -257,9 +260,7 @@ 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_.'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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`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)
|
||||
@@ -270,8 +271,8 @@ class SupplierCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
'.Product::sqlStock('p').'
|
||||
WHERE ps.`id_supplier` = '.(int)$id_supplier.
|
||||
($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
($active ? ' AND product_shop.`active` = 1' : '').'
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -304,6 +305,7 @@ class SupplierCore extends ObjectModel
|
||||
SELECT p.`id_product`,
|
||||
pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.'
|
||||
@@ -312,7 +314,7 @@ class SupplierCore extends ObjectModel
|
||||
ps.`id_product` = p.`id_product`
|
||||
AND ps.`id_supplier` = '.(int)$this->id.'
|
||||
)
|
||||
'.($front ? ' WHERE p.`visibility` IN ("both", "catalog")' : '').'
|
||||
'.($front ? ' WHERE product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
GROUP BY p.`id_product`';
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
+5
-4
@@ -139,8 +139,8 @@ class TagCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = pt.id_product)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE t.`id_lang` = '.(int)$id_lang.'
|
||||
AND p.`active` = 1
|
||||
AND p.`id_product` IN (
|
||||
AND product_shop.`active` = 1
|
||||
AND product_shop.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
@@ -179,8 +179,9 @@ class TagCore extends ObjectModel
|
||||
SELECT pl.name, pl.id_product
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE pl.id_lang = '.(int)$id_lang.'
|
||||
AND p.active = 1
|
||||
AND product_shop.active = 1
|
||||
'.($this->id ? ('AND p.id_product '.$in.' (SELECT pt.id_product FROM `'._DB_PREFIX_.'product_tag` pt WHERE pt.id_tag = '.(int)$this->id.')') : '').'
|
||||
ORDER BY pl.name');
|
||||
}
|
||||
@@ -191,7 +192,7 @@ class TagCore extends ObjectModel
|
||||
if (is_array($array))
|
||||
{
|
||||
$array = array_map('intval', $array);
|
||||
$result &= Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET indexed = 0 WHERE id_product IN ('.implode(',', $array).')');
|
||||
$result &= ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'id_product IN ('.implode(',', $array).')');
|
||||
$ids = array();
|
||||
foreach ($array as $id_product)
|
||||
$ids[] = '('.(int)$id_product.','.(int)$this->id.')';
|
||||
|
||||
+2
-1
@@ -759,9 +759,10 @@ class ToolsCore
|
||||
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`'.Shop::addSqlRestrictionOnLang('pl').')
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE pl.id_lang = '.(int)$id_lang.'
|
||||
AND pl.id_product = '.(int)$id_product.'
|
||||
AND p.active = 1';
|
||||
AND product_shop.active = 1';
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if ($row)
|
||||
{
|
||||
|
||||
@@ -73,6 +73,7 @@ class TranslateCore
|
||||
$str = Translate::getGenericAdminTranslation($string, $key, $_LANGADM);
|
||||
|
||||
$str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str;
|
||||
$str = str_replace('"', '"', $str);
|
||||
|
||||
if ($sprintf)
|
||||
{
|
||||
@@ -82,7 +83,7 @@ class TranslateCore
|
||||
$str = vsprintf($str, $sprintf);
|
||||
}
|
||||
|
||||
return str_replace('"', '"', ($addslashes ? addslashes($str) : stripslashes($str)));
|
||||
return ($addslashes ? addslashes($str) : stripslashes($str));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ class TranslatedConfigurationCore extends Configuration
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isConfigName', 'required' => true, 'size' => 32),
|
||||
'id_group_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
|
||||
'id_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
|
||||
'value' => array('type' => self::TYPE_STRING, 'lang' => true),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
|
||||
@@ -884,7 +884,7 @@ class AdminControllerCore extends Controller
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
|
||||
|
||||
// Set default value
|
||||
if (!Tools::getValue($field) && isset($values['default']))
|
||||
if (Tools::getValue($field) === false && isset($values['default']))
|
||||
$_POST[$field] = $values['default'];
|
||||
}
|
||||
|
||||
@@ -1269,7 +1269,7 @@ class AdminControllerCore extends Controller
|
||||
'multi_shop' => Shop::isFeatureActive(),
|
||||
'shop_list' => Helper::renderShopList(),
|
||||
'shop' => $this->context->shop,
|
||||
'group_shop' => $this->context->shop->getGroup(),
|
||||
'shop_group' => $this->context->shop->getGroup(),
|
||||
'tab' => $tab,
|
||||
'current_parent_id' => (int)Tab::getCurrentParentId(),
|
||||
'tabs' => $tabs,
|
||||
@@ -1675,7 +1675,7 @@ class AdminControllerCore extends Controller
|
||||
if (!($this->multishop_context & Shop::getContext()))
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && !($this->multishop_context & Shop::CONTEXT_SHOP))
|
||||
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextGroupShopID());
|
||||
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
|
||||
if (Shop::getContext() == Shop::CONTEXT_GROUP && !($this->multishop_context & Shop::CONTEXT_GROUP))
|
||||
Shop::setContext(Shop::CONTEXT_ALL);
|
||||
}
|
||||
@@ -1940,35 +1940,20 @@ class AdminControllerCore extends Controller
|
||||
$where_shop = Shop::addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
||||
}
|
||||
|
||||
if ($this->multishop_context)
|
||||
{
|
||||
$assos = Shop::getAssoTables();
|
||||
$assos_group = GroupShop::getAssoTables();
|
||||
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
|
||||
{
|
||||
$filter_key = $assos[$this->table]['type'];
|
||||
$idenfier_shop = Shop::getContextListShopID();
|
||||
}
|
||||
elseif (isset($assos_group[$this->table]) && $assos_group[$this->table]['type'] == 'group_shop')
|
||||
{
|
||||
$filter_key = $assos_group[$this->table]['type'];
|
||||
$idenfier_shop = array(Shop::getContextGroupShopID());
|
||||
}
|
||||
}
|
||||
|
||||
$filter_shop = '';
|
||||
if (isset($filter_key))
|
||||
if ($this->multishop_context && Shop::isTableAssociated($this->table))
|
||||
{
|
||||
$idenfier_shop = Shop::getContextListShopID();
|
||||
if (!$this->_group)
|
||||
$this->_group = ' GROUP BY a.'.pSQL($this->identifier);
|
||||
elseif (!preg_match('#(\s|,)\s*a\.`?'.pSQL($this->identifier).'`?(\s|,|$)#', $this->_group))
|
||||
$this->_group .= ', a.'.pSQL($this->identifier);
|
||||
|
||||
$test_join = !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_'.$filter_key).'`? *sa#', $this->_join);
|
||||
$test_join = !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_shop').'`? *sa#', $this->_join);
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && $test_join)
|
||||
{
|
||||
$filter_shop = ' JOIN `'._DB_PREFIX_.$this->table.'_'.$filter_key.'` sa ';
|
||||
$filter_shop .= 'ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filter_key.' IN ('.implode(', ', $idenfier_shop).'))';
|
||||
$filter_shop = ' JOIN `'._DB_PREFIX_.$this->table.'_shop` sa ';
|
||||
$filter_shop .= 'ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', $idenfier_shop).'))';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2055,15 +2040,11 @@ class AdminControllerCore extends Controller
|
||||
if (isset($fieldset['form']['input']))
|
||||
foreach ($fieldset['form']['input'] as $input)
|
||||
if (!isset($this->fields_value[$input['name']]))
|
||||
if (isset($input['type']) && ($input['type'] == 'group_shop' || $input['type'] == 'shop'))
|
||||
if (isset($input['type']) && $input['type'] == 'shop')
|
||||
{
|
||||
if ($obj->id)
|
||||
{
|
||||
if ($input['type'] == 'group_shop')
|
||||
$result = GroupShop::getGroupShopById((int)$obj->id, $this->identifier, $this->table);
|
||||
else
|
||||
$result = Shop::getShopById((int)$obj->id, $this->identifier, $this->table);
|
||||
|
||||
foreach ($result as $row)
|
||||
$this->fields_value['shop'][$row['id_'.$input['type']]][] = $row[$this->identifier];
|
||||
}
|
||||
@@ -2299,15 +2280,15 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
protected function getAssoShop($table, $id_object = false)
|
||||
{
|
||||
$shop_asso = Shop::getAssoTables();
|
||||
$group_shop_asso = GroupShop::getAssoTables();
|
||||
if (isset($shop_asso[$table]) && $shop_asso[$table]['type'] == 'shop')
|
||||
if (Shop::isTableAssociated($table))
|
||||
$type = 'shop';
|
||||
elseif (isset($group_shop_asso[$table]) && $group_shop_asso[$table]['type'] == 'group_shop')
|
||||
$type = 'group_shop';
|
||||
else
|
||||
return;
|
||||
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
if (count($shops) == 1)
|
||||
return array($shops[0], 'shop');
|
||||
|
||||
$assos = array();
|
||||
if (Tools::isSubmit('checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table))
|
||||
{
|
||||
@@ -2334,6 +2315,10 @@ class AdminControllerCore extends Controller
|
||||
if (!Shop::isFeatureActive())
|
||||
return;
|
||||
|
||||
$def = ObjectModel::getDefinition($this->className);
|
||||
if (!empty($def['multishop']))
|
||||
return;
|
||||
|
||||
$assos_data = $this->getAssoShop($this->table, $id_object);
|
||||
$assos = $assos_data[0];
|
||||
$type = $assos_data[1];
|
||||
|
||||
@@ -232,7 +232,7 @@ class FrontControllerCore extends Controller
|
||||
$cart->id_lang = (int)($this->context->cookie->id_lang);
|
||||
$cart->id_currency = (int)($this->context->cookie->id_currency);
|
||||
$cart->id_guest = (int)($this->context->cookie->id_guest);
|
||||
$cart->id_group_shop = (int)$this->context->shop->id_group_shop;
|
||||
$cart->id_shop_group = (int)$this->context->shop->id_shop_group;
|
||||
$cart->id_shop = $this->context->shop->id;
|
||||
if ($this->context->cookie->id_customer)
|
||||
{
|
||||
|
||||
@@ -348,7 +348,7 @@ class HelperCore
|
||||
|
||||
public static function renderShopList()
|
||||
{
|
||||
if (!Shop::isFeatureActive())
|
||||
if (!Shop::isFeatureActive() || count(Shop::getShops(false, null, true)) < 2)
|
||||
return null;
|
||||
|
||||
$tree = Shop::getTree();
|
||||
@@ -358,7 +358,7 @@ class HelperCore
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$value = '';
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$value = 'g-'.Shop::getContextGroupShopID();
|
||||
$value = 'g-'.Shop::getContextShopGroupID();
|
||||
else
|
||||
$value = 's-'.Shop::getContextShopID();
|
||||
|
||||
@@ -369,7 +369,7 @@ class HelperCore
|
||||
$html .= '<option value="" class="first">'.translate('All shops').'</option>';
|
||||
foreach ($tree as $gID => $group_data)
|
||||
{
|
||||
if (!isset($context->controller->multishop_context) || $context->controller->multishop_context & Shop::CONTEXT_GROUP)
|
||||
if ((!isset($context->controller->multishop_context) || $context->controller->multishop_context & Shop::CONTEXT_GROUP) && count($group_data['shops']) > 1)
|
||||
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').'>'.translate('Group:').' '.htmlspecialchars($group_data['name']).'</option>';
|
||||
else
|
||||
$html .= '<optgroup class="group" label="'.translate('Group:').' '.htmlspecialchars($group_data['name']).'">';
|
||||
|
||||
@@ -137,8 +137,10 @@ class HelperFormCore extends Helper
|
||||
break;
|
||||
|
||||
case 'shop' :
|
||||
case 'group_shop' :
|
||||
$params['html'] = $this->renderAssoShop($params['type']);
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
if (count($shops) == 1)
|
||||
unset($this->fields_form[$fieldset_key]['form']['input'][$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -186,69 +188,59 @@ class HelperFormCore extends Helper
|
||||
/**
|
||||
* Render an area to determinate shop association
|
||||
*
|
||||
* @param string $type 'shop' or 'group_shop'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderAssoShop($type = 'shop')
|
||||
public function renderAssoShop()
|
||||
{
|
||||
if (!Shop::isFeatureActive())
|
||||
return;
|
||||
|
||||
if ($type != 'shop' && $type != 'group_shop')
|
||||
$type = 'shop';
|
||||
|
||||
$assos = array();
|
||||
if ((int)$this->id)
|
||||
{
|
||||
$sql = 'SELECT `id_'.$type.'`, `'.bqSQL($this->identifier).'`
|
||||
FROM `'._DB_PREFIX_.bqSQL($this->table).'_'.$type.'`
|
||||
$sql = 'SELECT `id_shop`, `'.bqSQL($this->identifier).'`
|
||||
FROM `'._DB_PREFIX_.bqSQL($this->table).'_shop`
|
||||
WHERE `'.bqSQL($this->identifier).'` = '.(int)$this->id;
|
||||
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$assos[$row['id_'.$type]] = $row['id_'.$type];
|
||||
$assos[$row['id_shop']] = $row['id_shop'];
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Shop::getContext())
|
||||
{
|
||||
case Shop::CONTEXT_SHOP :
|
||||
if ($type == 'shop')
|
||||
$assos[Shop::getContextShopID()] = Shop::getContextShopID();
|
||||
else
|
||||
$assos[Shop::getContextGroupShopID()] = Shop::getContextGroupShopID();
|
||||
break;
|
||||
|
||||
case Shop::CONTEXT_GROUP :
|
||||
if ($type == 'shop')
|
||||
foreach (Shop::getShops(false, Shop::getContextGroupShopID(), true) as $id_shop)
|
||||
foreach (Shop::getShops(false, Shop::getContextShopGroupID(), true) as $id_shop)
|
||||
$assos[$id_shop] = $id_shop;
|
||||
else
|
||||
$assos[Shop::getContextGroupShopID()] = Shop::getContextGroupShopID();
|
||||
break;
|
||||
|
||||
default :
|
||||
if ($type == 'shop')
|
||||
foreach (Shop::getShops(false, null, true) as $id_shop)
|
||||
$assos[$id_shop] = $id_shop;
|
||||
else
|
||||
foreach (Shop::getTree() as $group_shop)
|
||||
$assos[$group_shop['id']] = $group_shop['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = $this->createTemplate('assoshop.tpl');
|
||||
$tree = Shop::getTree();
|
||||
$nb_shop = 0;
|
||||
foreach ($tree as $value)
|
||||
$nb_shop += count($value['shops']);
|
||||
$tpl->assign(array(
|
||||
'input' => array(
|
||||
'type' => $type,
|
||||
'values' => Shop::getTree(),
|
||||
'type' => 'shop',
|
||||
'values' => $tree,
|
||||
),
|
||||
'fields_value' => array(
|
||||
'shop' => $assos
|
||||
),
|
||||
'form_id' => $this->id,
|
||||
'table' => $this->table
|
||||
'table' => $this->table,
|
||||
'nb_shop' => $nb_shop
|
||||
));
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ class HelperOptionsCore extends Helper
|
||||
if (!isset($languages))
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
$use_multishop = false;
|
||||
foreach ($option_list as $category => $category_data)
|
||||
{
|
||||
if (!is_array($category_data))
|
||||
@@ -125,7 +126,12 @@ class HelperOptionsCore extends Helper
|
||||
}
|
||||
|
||||
// Multishop default value
|
||||
$field['multishop_default'] = (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && !$isInvisible);
|
||||
$field['multishop_default'] = false;
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && !$isInvisible)
|
||||
{
|
||||
$field['multishop_default'] = true;
|
||||
$use_multishop = true;
|
||||
}
|
||||
|
||||
// Assign the modifications back to parent array
|
||||
$category_data['fields'][$key] = $field;
|
||||
@@ -151,6 +157,7 @@ class HelperOptionsCore extends Helper
|
||||
'languages' => isset($languages) ? $languages : null,
|
||||
'currency_left_sign' => $this->context->currency->getSign('left'),
|
||||
'currency_right_sign' => $this->context->currency->getSign('right'),
|
||||
'use_multishop' => $use_multishop,
|
||||
));
|
||||
|
||||
return parent::generate();
|
||||
|
||||
@@ -33,7 +33,7 @@ class OrderCore extends ObjectModel
|
||||
/** @var integer Invoice address id */
|
||||
public $id_address_invoice;
|
||||
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
|
||||
public $id_shop;
|
||||
|
||||
@@ -165,7 +165,7 @@ class OrderCore extends ObjectModel
|
||||
'id_address_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
@@ -490,6 +490,7 @@ class OrderCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON p.id_product = od.product_id
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE od.`id_order` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON p.id_product = od.product_id
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE od.`id_order` = '.(int)$this->id_order.'
|
||||
AND od.`id_order_invoice` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class GroupShopCore extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $active;
|
||||
public $share_customer;
|
||||
public $share_stock;
|
||||
public $share_order;
|
||||
public $deleted;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'group_shop',
|
||||
'primary' => 'id_group_shop',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
|
||||
'share_customer' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'share_order' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'share_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
),
|
||||
);
|
||||
|
||||
private static $assoTables = array(
|
||||
'attribute_group' => array('type' => 'group_shop'),
|
||||
'attribute' => array('type' => 'group_shop'),
|
||||
'feature' => array('type' => 'group_shop'),
|
||||
'group' => array('type' => 'group_shop'),
|
||||
'manufacturer' => array('type' => 'group_shop'),
|
||||
'supplier' => array('type' => 'group_shop'),
|
||||
'zone' => array('type' => 'group_shop'),
|
||||
'tax_rules_group' => array('type' => 'group_shop'),
|
||||
);
|
||||
|
||||
/**
|
||||
* @see ObjectModel::getFields()
|
||||
* @return array
|
||||
*/
|
||||
public function getFields()
|
||||
{
|
||||
if (!$this->share_customer || !$this->share_stock)
|
||||
$this->share_order = false;
|
||||
|
||||
return parent::getFields();
|
||||
}
|
||||
|
||||
public static function getGroupShops($active = true)
|
||||
{
|
||||
$groups = new Collection('GroupShop');
|
||||
$groups->where('deleted', '=', false);
|
||||
if ($active)
|
||||
$groups->where('active', '=', true);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!$res = parent::delete())
|
||||
return false;
|
||||
|
||||
foreach (GroupShop::getAssoTables() as $table_name => $row)
|
||||
{
|
||||
$id = 'id_'.$row['type'];
|
||||
if ($row['type'] == 'fk_group_shop')
|
||||
$id = 'id_group_shop';
|
||||
else
|
||||
$table_name .= '_'.$row['type'];
|
||||
$res &= Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$table_name.'` WHERE `'.$id.'`='.(int)$this->id);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function getAssoTables()
|
||||
{
|
||||
return self::$assoTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Total of groupshops
|
||||
*/
|
||||
public static function getTotalGroupShops($active = true)
|
||||
{
|
||||
return count(GroupShop::getGroupShops($active));
|
||||
}
|
||||
|
||||
public function haveShops()
|
||||
{
|
||||
return (bool)$this->getTotalShops();
|
||||
}
|
||||
|
||||
public function getTotalShops()
|
||||
{
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'shop s
|
||||
WHERE id_group_shop='.(int)$this->id;
|
||||
return (int)Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a group shop ID from group shop name
|
||||
*
|
||||
* @param string $name
|
||||
* @return int
|
||||
*/
|
||||
public static function getIdByName($name)
|
||||
{
|
||||
$sql = 'SELECT id_group_shop
|
||||
FROM '._DB_PREFIX_.'group_shop
|
||||
WHERE name = \''.pSQL($name).'\'';
|
||||
return (int)Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of group shop by id
|
||||
*
|
||||
* @param int $id
|
||||
* @param string $identifier
|
||||
* @param string $table
|
||||
* @return array
|
||||
*/
|
||||
public static function getGroupShopById($id, $identifier, $table)
|
||||
{
|
||||
return Db::getInstance()->executeS('SELECT `id_group_shop`, `'.pSQL($identifier).'` FROM `'._DB_PREFIX_.pSQL($table).'_group_shop` WHERE `'.pSQL($identifier).'` = '.(int)$id);
|
||||
}
|
||||
|
||||
public function copyGroupShopData($old_id, $tables_import = false, $deleted = false)
|
||||
{
|
||||
foreach (GroupShop::getAssoTables() as $table_name => $row)
|
||||
{
|
||||
if ($tables_import && !isset($tables_import[$table_name]))
|
||||
continue;
|
||||
|
||||
$id = 'id_'.$row['type'];
|
||||
if ($row['type'] == 'fk_group_shop')
|
||||
$id = 'id_group_shop';
|
||||
else
|
||||
$table_name .= '_'.$row['type'];
|
||||
|
||||
if (!$deleted)
|
||||
{
|
||||
$res = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.$table_name.'` WHERE `'.$id.'` = '.(int)$old_id);
|
||||
if ($res)
|
||||
{
|
||||
unset($res[$id]);
|
||||
if (isset($row['primary']))
|
||||
unset($res[$row['primary']]);
|
||||
|
||||
$keys = implode(', ', array_keys($res));
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$table_name.'` ('.$keys.', '.$id.')
|
||||
(SELECT '.$keys.', '.(int)$this->id.' FROM '._DB_PREFIX_.$table_name.'
|
||||
WHERE `'.$id.'` = '.(int)$old_id.')';
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+57
-52
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
class ShopCore extends ObjectModel
|
||||
{
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
public $id_theme;
|
||||
public $name;
|
||||
public $active = true;
|
||||
@@ -45,7 +45,7 @@ class ShopCore extends ObjectModel
|
||||
public $domain_ssl;
|
||||
|
||||
/**
|
||||
* @var GroupShop
|
||||
* @var ShopGroup
|
||||
*/
|
||||
protected $group;
|
||||
|
||||
@@ -61,7 +61,7 @@ class ShopCore extends ObjectModel
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
|
||||
'id_theme' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'id_category' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -88,6 +88,7 @@ class ShopCore extends ObjectModel
|
||||
'module_country' => array('type' => 'fk_shop'),
|
||||
'module_group' => array('type' => 'fk_shop'),
|
||||
'product' => array('type' => 'shop'),
|
||||
'product_attribute' => array('type' => 'shop'),
|
||||
'product_lang' => array('type' => 'fk_shop'),
|
||||
'referrer' => array('type' => 'shop'),
|
||||
'scene' => array('type' => 'shop'),
|
||||
@@ -95,13 +96,20 @@ class ShopCore extends ObjectModel
|
||||
'webservice_account' => array('type' => 'shop'),
|
||||
'warehouse' => array('type' => 'shop'),
|
||||
'stock_available' => array('type' => 'fk_shop'),
|
||||
'product_tax_rules_group_shop' => array('type' => 'fk_shop'),
|
||||
'carrier_tax_rules_group_shop' => array('type' => 'fk_shop'),
|
||||
'attribute' => array('type' => 'shop'),
|
||||
'feature' => array('type' => 'shop'),
|
||||
'group' => array('type' => 'shop'),
|
||||
'attribute_group' => array('type' => 'shop'),
|
||||
'tax_rules_group' => array('type' => 'shop'),
|
||||
'zone' => array('type' => 'shop'),
|
||||
'manufacturer' => array('type' => 'shop'),
|
||||
'supplier' => array('type' => 'shop'),
|
||||
);
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'fields' => array(
|
||||
'id_group_shop' => array('xlink_resource' => 'shop_groups'),
|
||||
'id_shop_group' => array('xlink_resource' => 'shop_groups'),
|
||||
'id_category' => array(),
|
||||
'id_theme' => array(),
|
||||
),
|
||||
@@ -109,7 +117,7 @@ class ShopCore extends ObjectModel
|
||||
|
||||
protected static $context;
|
||||
protected static $context_id_shop;
|
||||
protected static $context_id_group_shop;
|
||||
protected static $context_id_shop_group;
|
||||
|
||||
/**
|
||||
* There are 3 kinds of shop context : shop, group shop and general
|
||||
@@ -371,12 +379,12 @@ class ShopCore extends ObjectModel
|
||||
/**
|
||||
* Get group of current shop
|
||||
*
|
||||
* @return GroupShop
|
||||
* @return ShopGroup
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
if (!$this->group)
|
||||
$this->group = new GroupShop($this->id_group_shop);
|
||||
$this->group = new ShopGroup($this->id_shop_group);
|
||||
return $this->group;
|
||||
}
|
||||
|
||||
@@ -424,6 +432,17 @@ class ShopCore extends ObjectModel
|
||||
return self::$asso_tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given table is associated to shop
|
||||
*
|
||||
* @param string $table
|
||||
* @return bool
|
||||
*/
|
||||
public static function isTableAssociated($table)
|
||||
{
|
||||
return isset(self::$asso_tables[$table]) && self::$asso_tables[$table]['type'] == 'shop';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load list of groups and shops, and cache it
|
||||
*
|
||||
@@ -451,9 +470,9 @@ class ShopCore extends ObjectModel
|
||||
}
|
||||
|
||||
$sql = 'SELECT gs.*, s.*, gs.name AS group_name, s.name AS shop_name, s.active, su.domain, su.domain_ssl, su.physical_uri, su.virtual_uri'.$select.'
|
||||
FROM '._DB_PREFIX_.'group_shop gs
|
||||
FROM '._DB_PREFIX_.'shop_group gs
|
||||
LEFT JOIN '._DB_PREFIX_.'shop s
|
||||
ON s.id_group_shop = gs.id_group_shop
|
||||
ON s.id_shop_group = gs.id_shop_group
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su
|
||||
ON s.id_shop = su.id_shop AND su.main = 1
|
||||
'.$from.'
|
||||
@@ -466,19 +485,19 @@ class ShopCore extends ObjectModel
|
||||
{
|
||||
foreach ($results as $row)
|
||||
{
|
||||
if (!isset(self::$shops[$row['id_group_shop']]))
|
||||
self::$shops[$row['id_group_shop']] = array(
|
||||
'id' => $row['id_group_shop'],
|
||||
if (!isset(self::$shops[$row['id_shop_group']]))
|
||||
self::$shops[$row['id_shop_group']] = array(
|
||||
'id' => $row['id_shop_group'],
|
||||
'name' => $row['group_name'],
|
||||
'share_customer' => $row['share_customer'],
|
||||
'share_order' => $row['share_order'],
|
||||
'totalShops' => Shop::getTotalShopsByIdGroupShop($row['id_group_shop']),
|
||||
'totalShops' => Shop::getTotalShopsByIdShopGroup($row['id_shop_group']),
|
||||
'shops' => array(),
|
||||
);
|
||||
|
||||
self::$shops[$row['id_group_shop']]['shops'][$row['id_shop']] = array(
|
||||
self::$shops[$row['id_shop_group']]['shops'][$row['id_shop']] = array(
|
||||
'id_shop' => $row['id_shop'],
|
||||
'id_group_shop' => $row['id_group_shop'],
|
||||
'id_shop_group' => $row['id_shop_group'],
|
||||
'name' => $row['shop_name'],
|
||||
'id_theme' => $row['id_theme'],
|
||||
'id_category' => $row['id_category'],
|
||||
@@ -495,17 +514,17 @@ class ShopCore extends ObjectModel
|
||||
* Get shops list
|
||||
*
|
||||
* @param bool $active
|
||||
* @param int $id_group_shop
|
||||
* @param int $id_shop_group
|
||||
* @param bool $get_as_list_id
|
||||
*/
|
||||
public static function getShops($active = true, $id_group_shop = null, $get_as_list_id = false)
|
||||
public static function getShops($active = true, $id_shop_group = null, $get_as_list_id = false)
|
||||
{
|
||||
Shop::cacheShops();
|
||||
|
||||
$results = array();
|
||||
foreach (self::$shops as $group_id => $group_data)
|
||||
foreach ($group_data['shops'] as $id => $shop_data)
|
||||
if ((!$active || $shop_data['active']) && (!$id_group_shop || $id_group_shop == $group_id))
|
||||
if ((!$active || $shop_data['active']) && (!$id_shop_group || $id_shop_group == $group_id))
|
||||
{
|
||||
if ($get_as_list_id)
|
||||
$results[$id] = $id;
|
||||
@@ -565,14 +584,14 @@ class ShopCore extends ObjectModel
|
||||
/**
|
||||
* @return int Total of shops
|
||||
*/
|
||||
public static function getTotalShopsByIdGroupShop($id)
|
||||
public static function getTotalShopsByIdShopGroup($id)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'shop` WHERE `id_group_shop` = '.(int)$id);
|
||||
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'shop` WHERE `id_shop_group` = '.(int)$id);
|
||||
}
|
||||
|
||||
public static function getIdShopsByIdGroupShop($id)
|
||||
public static function getIdShopsByIdShopGroup($id)
|
||||
{
|
||||
$result = Db::getInstance()->executeS('SELECT `id_shop`, `id_group_shop` FROM `'._DB_PREFIX_.'shop` WHERE `id_group_shop` = '.(int)$id);
|
||||
$result = Db::getInstance()->executeS('SELECT `id_shop`, `id_shop_group` FROM `'._DB_PREFIX_.'shop` WHERE `id_shop_group` = '.(int)$id);
|
||||
$data = array();
|
||||
foreach ($result as $group_data)
|
||||
$data[] = (int)$group_data['id_shop'];
|
||||
@@ -624,7 +643,7 @@ class ShopCore extends ObjectModel
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$list = ($share) ? Shop::getSharedShops(Shop::getContextShopID(), $share) : array(Shop::getContextShopID());
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$list = Shop::getShops(true, Shop::getContextGroupShopID(), true);
|
||||
$list = Shop::getShops(true, Shop::getContextShopGroupID(), true);
|
||||
else
|
||||
$list = Shop::getShops(true, null, true);
|
||||
|
||||
@@ -650,17 +669,17 @@ class ShopCore extends ObjectModel
|
||||
{
|
||||
case self::CONTEXT_ALL :
|
||||
self::$context_id_shop = null;
|
||||
self::$context_id_group_shop = null;
|
||||
self::$context_id_shop_group = null;
|
||||
break;
|
||||
|
||||
case self::CONTEXT_GROUP :
|
||||
self::$context_id_shop = null;
|
||||
self::$context_id_group_shop = (int)$id;
|
||||
self::$context_id_shop_group = (int)$id;
|
||||
break;
|
||||
|
||||
case self::CONTEXT_SHOP :
|
||||
self::$context_id_shop = (int)$id;
|
||||
self::$context_id_group_shop = Shop::getGroupFromShop($id);
|
||||
self::$context_id_shop_group = Shop::getGroupFromShop($id);
|
||||
break;
|
||||
|
||||
default :
|
||||
@@ -680,9 +699,9 @@ class ShopCore extends ObjectModel
|
||||
return self::$context_id_shop;
|
||||
}
|
||||
|
||||
public static function getContextGroupShopID()
|
||||
public static function getContextShopGroupID()
|
||||
{
|
||||
return self::$context_id_group_shop;
|
||||
return self::$context_id_shop_group;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -690,29 +709,17 @@ class ShopCore extends ObjectModel
|
||||
*
|
||||
* @param int $share If false, dont check share datas from group. Else can take a Shop::SHARE_* constant value
|
||||
* @param string $alias
|
||||
* @param string $type shop|group_shop
|
||||
*/
|
||||
public static function addSqlRestriction($share = false, $alias = null, $type = 'shop')
|
||||
public static function addSqlRestriction($share = false, $alias = null)
|
||||
{
|
||||
if ($type != 'shop' && $type != 'group_shop')
|
||||
$type = 'shop';
|
||||
|
||||
if ($alias)
|
||||
$alias .= '.';
|
||||
|
||||
$restriction = '';
|
||||
if ($type == 'group_shop')
|
||||
{
|
||||
if (Shop::getContext() != Shop::CONTEXT_ALL)
|
||||
$restriction = ' AND '.$alias.'id_group_shop = '.Shop::getContextGroupShopID().' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Shop::getContext() != Shop::CONTEXT_ALL)
|
||||
$restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', Shop::getContextListShopID($share)).') ';
|
||||
//else if ($share == Shop::SHARE_STOCK)
|
||||
// $restriction = ' AND '.$alias.'id_shop = '.$this->getID(true);
|
||||
}
|
||||
|
||||
return $restriction;
|
||||
}
|
||||
@@ -728,7 +735,7 @@ class ShopCore extends ObjectModel
|
||||
*/
|
||||
public static function addSqlAssociation($table, $alias, $inner_join = true)
|
||||
{
|
||||
$table_alias = ' asso_shop_'.$table;
|
||||
$table_alias = $table.'_shop';
|
||||
if (strpos($table, '.') !== false)
|
||||
list($table_alias, $table) = explode('.', $table);
|
||||
|
||||
@@ -781,9 +788,6 @@ class ShopCore extends ObjectModel
|
||||
|
||||
public function copyShopData($old_id, $tables_import = false, $deleted = false)
|
||||
{
|
||||
if (isset($tables_import['product']))
|
||||
$tables_import['product_tax_rules_group_shop'] = true;
|
||||
|
||||
if (isset($tables_import['carrier']))
|
||||
$tables_import['carrier_tax_rules_group_shop'] = true;
|
||||
|
||||
@@ -795,7 +799,7 @@ class ShopCore extends ObjectModel
|
||||
// Special case for stock_available if current shop is in a share stock group
|
||||
if ($table_name == 'stock_available')
|
||||
{
|
||||
$group = new GroupShop($this->id_group_shop);
|
||||
$group = new ShopGroup($this->id_shop_group);
|
||||
if ($group->share_stock && $group->haveShops())
|
||||
continue;
|
||||
}
|
||||
@@ -815,9 +819,9 @@ class ShopCore extends ObjectModel
|
||||
if (isset($row['primary']))
|
||||
unset($res[$row['primary']]);
|
||||
|
||||
$keys = implode(', ', array_keys($res));
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$table_name.'` ('.$keys.', '.$id.')
|
||||
(SELECT '.$keys.', '.(int)$this->id.' FROM '._DB_PREFIX_.$table_name.'
|
||||
$keys = implode('`, `', array_keys($res));
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$table_name.'` (`'.$keys.'`, '.$id.')
|
||||
(SELECT `'.$keys.'`, '.(int)$this->id.' FROM '._DB_PREFIX_.$table_name.'
|
||||
WHERE `'.$id.'` = '.(int)$old_id.')';
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
@@ -834,9 +838,9 @@ class ShopCore extends ObjectModel
|
||||
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM`'._DB_PREFIX_.'shop` WHERE `id_shop` = '.(int)$id);
|
||||
}
|
||||
|
||||
public function checkIfGroupShopExist($id)
|
||||
public function checkIfShopGroupExist($id)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM`'._DB_PREFIX_.'group_shop` WHERE `id_group_shop` = '.(int)$id);
|
||||
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM`'._DB_PREFIX_.'shop_group` WHERE `id_shop_group` = '.(int)$id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -905,6 +909,7 @@ class ShopCore extends ObjectModel
|
||||
return (bool)Db::getInstance()->getValue('
|
||||
SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp
|
||||
ON p.`id_product` = cp.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class ShopGroupCore extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $active;
|
||||
public $share_customer;
|
||||
public $share_stock;
|
||||
public $share_order;
|
||||
public $deleted;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'shop_group',
|
||||
'primary' => 'id_shop_group',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
|
||||
'share_customer' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'share_order' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'share_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @see ObjectModel::getFields()
|
||||
* @return array
|
||||
*/
|
||||
public function getFields()
|
||||
{
|
||||
if (!$this->share_customer || !$this->share_stock)
|
||||
$this->share_order = false;
|
||||
|
||||
return parent::getFields();
|
||||
}
|
||||
|
||||
public static function getShopGroups($active = true)
|
||||
{
|
||||
$groups = new Collection('ShopGroup');
|
||||
$groups->where('deleted', '=', false);
|
||||
if ($active)
|
||||
$groups->where('active', '=', true);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Total of shop groups
|
||||
*/
|
||||
public static function getTotalShopGroup($active = true)
|
||||
{
|
||||
return count(ShopGroup::getShopGroups($active));
|
||||
}
|
||||
|
||||
public function haveShops()
|
||||
{
|
||||
return (bool)$this->getTotalShops();
|
||||
}
|
||||
|
||||
public function getTotalShops()
|
||||
{
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'shop s
|
||||
WHERE id_shop_group='.(int)$this->id;
|
||||
return (int)Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a group shop ID from group shop name
|
||||
*
|
||||
* @param string $name
|
||||
* @return int
|
||||
*/
|
||||
public static function getIdByName($name)
|
||||
{
|
||||
$sql = 'SELECT id_shop_group
|
||||
FROM '._DB_PREFIX_.'shop_group
|
||||
WHERE name = \''.pSQL($name).'\'';
|
||||
return (int)Db::getInstance()->getValue($sql);
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class StockAvailableCore extends ObjectModel
|
||||
public $id_shop;
|
||||
|
||||
/** @var int the group shop associated to the current product and corresponding quantity */
|
||||
public $id_group_shop;
|
||||
public $id_shop_group;
|
||||
|
||||
/** @var int the quantity available for sale */
|
||||
public $quantity = 0;
|
||||
@@ -64,7 +64,7 @@ class StockAvailableCore extends ObjectModel
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'depends_on_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
||||
'out_of_stock' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
@@ -79,7 +79,7 @@ class StockAvailableCore extends ObjectModel
|
||||
'id_product' => array('xlink_resource' => 'products'),
|
||||
'id_product_attribute' => array('xlink_resource' => 'combinations'),
|
||||
'id_shop' => array('xlink_resource' => 'shops'),
|
||||
'id_group_shop' => array('xlink_resource' => 'shop_groups'),
|
||||
'id_shop_group' => array('xlink_resource' => 'shop_groups'),
|
||||
),
|
||||
'hidden_fields' => array(
|
||||
),
|
||||
@@ -415,22 +415,22 @@ class StockAvailableCore extends ObjectModel
|
||||
$stock_available->id_product_attribute = (int)$id_product_attribute;
|
||||
$stock_available->quantity = (int)$quantity;
|
||||
|
||||
// if we are in group_shop context
|
||||
// if we are in shop_group context
|
||||
if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
$group_shop = $context->shop->getGroup();
|
||||
$shop_group = $context->shop->getGroup();
|
||||
|
||||
// if quantities are shared between shops of the group
|
||||
if ($group_shop->share_stock)
|
||||
if ($shop_group->share_stock)
|
||||
{
|
||||
$stock_available->id_shop = 0;
|
||||
$stock_available->id_group_shop = (int)$group_shop->id;
|
||||
$stock_available->id_shop_group = (int)$shop_group->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stock_available->id_shop = $id_shop;
|
||||
$stock_available->id_group_shop = Shop::getGroupFromShop($id_shop);
|
||||
$stock_available->id_shop_group = Shop::getGroupFromShop($id_shop);
|
||||
}
|
||||
|
||||
$stock_available->add();
|
||||
@@ -468,13 +468,13 @@ class StockAvailableCore extends ObjectModel
|
||||
* If stocks are shared, remoe all old available quantities for all shops of the group
|
||||
* Else remove all available quantities for the current group
|
||||
*
|
||||
* @param GroupShop $group_shop the GroupShop object
|
||||
* @param ShopGroup $shop_group the ShopGroup object
|
||||
*/
|
||||
public static function resetProductFromStockAvailableByGroupShop($group_shop)
|
||||
public static function resetProductFromStockAvailableByShopGroup(ShopGroup $shop_group)
|
||||
{
|
||||
if ($group_shop->share_stock)
|
||||
if ($shop_group->share_stock)
|
||||
{
|
||||
$shop_list = Shop::getIdShopsByIdGroupShop($group_shop->id);
|
||||
$shop_list = Shop::getIdShopsByIdShopGroup($shop_group->id);
|
||||
|
||||
if (count($shop_list) > 0)
|
||||
{
|
||||
@@ -490,7 +490,7 @@ class StockAvailableCore extends ObjectModel
|
||||
{
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'stock_available
|
||||
WHERE id_group_shop = '.$group_shop->id
|
||||
WHERE id_shop_group = '.$shop_group->id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -561,20 +561,20 @@ class StockAvailableCore extends ObjectModel
|
||||
if (is_null($id_shop))
|
||||
$id_shop = $context->shop->id;
|
||||
|
||||
// if we are in group_shop context
|
||||
$group_shop = $context->shop->getGroup();
|
||||
// if we are in $shop_group context
|
||||
$shop_group = $context->shop->getGroup();
|
||||
|
||||
// if quantities are shared between shops of the group
|
||||
if ($group_shop->share_stock)
|
||||
if ($shop_group->share_stock)
|
||||
{
|
||||
if (is_object($sql))
|
||||
{
|
||||
$sql->where(pSQL($alias).'id_group_shop = '.(int)$group_shop->id);
|
||||
$sql->where(pSQL($alias).'id_shop_group = '.(int)$shop_group->id);
|
||||
$sql->where(pSQL($alias).'id_shop = 0');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = ' AND '.pSQL($alias).'id_group_shop = '.(int)$group_shop->id.' ';
|
||||
$sql = ' AND '.pSQL($alias).'id_shop_group = '.(int)$shop_group->id.' ';
|
||||
$sql .= ' AND '.pSQL($alias).'id_shop = 0 ';
|
||||
}
|
||||
}
|
||||
@@ -582,9 +582,9 @@ class StockAvailableCore extends ObjectModel
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
if (is_object($sql))
|
||||
$sql->where(pSQL($alias).'id_shop IN ('.implode(', ', Shop::getShops(true, $group_shop->id, true)).')');
|
||||
$sql->where(pSQL($alias).'id_shop IN ('.implode(', ', Shop::getShops(true, $shop_group->id, true)).')');
|
||||
else
|
||||
$sql = ' AND '.pSQL($alias).'id_shop IN ('.implode(', ', Shop::getShops(true, $group_shop->id, true)).') ';
|
||||
$sql = ' AND '.pSQL($alias).'id_shop IN ('.implode(', ', Shop::getShops(true, $shop_group->id, true)).') ';
|
||||
}
|
||||
// if no group specific restriction, set simple shop restriction
|
||||
else
|
||||
@@ -614,18 +614,18 @@ class StockAvailableCore extends ObjectModel
|
||||
if (is_null($id_shop))
|
||||
$id_shop = $context->shop->id;
|
||||
|
||||
$group_shop = $context->shop->getGroup();
|
||||
$shop_group = $context->shop->getGroup();
|
||||
|
||||
// if quantities are shared between shops of the group
|
||||
if ($group_shop->share_stock)
|
||||
if ($shop_group->share_stock)
|
||||
{
|
||||
$params['id_group_shop'] = (int)$group_shop->id;
|
||||
$params['id_shop_group'] = (int)$shop_group->id;
|
||||
$params['id_shop'] = 0;
|
||||
|
||||
$group_ok = true;
|
||||
}
|
||||
else
|
||||
$params['id_group_shop'] = 0;
|
||||
$params['id_shop_group'] = 0;
|
||||
|
||||
// if no group specific restriction, set simple shop restriction
|
||||
if (!$group_ok)
|
||||
@@ -650,7 +650,7 @@ class StockAvailableCore extends ObjectModel
|
||||
id_product,
|
||||
id_product_attribute,
|
||||
id_shop,
|
||||
id_group_shop,
|
||||
id_shop_group,
|
||||
quantity,
|
||||
depends_on_stock,
|
||||
out_of_stock
|
||||
|
||||
@@ -592,7 +592,9 @@ class StockManagerCore implements StockManagerInterface
|
||||
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock` s ON (sm.`id_stock` = s.`id_stock`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = s.`id_product`)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE sm.`sign` = -1
|
||||
AND sm.`id_stock_mvt_reason` != '.Configuration::get('PS_STOCK_MVT_TRANSFER_FROM').'
|
||||
AND TO_DAYS(NOW()) - TO_DAYS(sm.`date_add`) <= '.(int)$coverage.'
|
||||
|
||||
@@ -263,7 +263,7 @@ class WebserviceRequestCore
|
||||
'search' => array('description' => 'Search', 'specific_management' => true, 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
'content_management_system' => array('description' => 'Content management system', 'class' => 'CMS'),
|
||||
'shops' => array('description' => 'Shops from multi-shop feature', 'class' => 'Shop'),
|
||||
'shop_groups' => array('description' => 'Shop groups from multi-shop feature', 'class' => 'GroupShop'),
|
||||
'shop_groups' => array('description' => 'Shop groups from multi-shop feature', 'class' => 'ShopGroup'),
|
||||
'taxes' => array('description' => 'The tax rate', 'class' => 'Tax'),
|
||||
'stock_movements' => array('description' => 'Stock movements', 'class' => 'StockMvtWS', 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
'stock_movement_reasons' => array('description' => 'Stock movement reason', 'class' => 'StockMvtReason'),
|
||||
|
||||
@@ -486,7 +486,7 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
odt.`total_amount` AS tax_total_amount,
|
||||
od.`product_id` AS id_product,
|
||||
od.`product_attribute_id` as id_product_attribute,
|
||||
p.`advanced_stock_management`
|
||||
product_shop.`advanced_stock_management`
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` customer ON customer.`id_customer` = o.`id_customer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` a ON a.`id_customer` = o.`id_customer`
|
||||
@@ -497,6 +497,7 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON t.`id_tax` = odt.`id_tax`
|
||||
LEFT JOIN `'._DB_PREFIX_.'country` country ON country.`id_country` = a.`id_country`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = od.`product_id`
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'accounting_product_zone_shop` acc_pzs
|
||||
ON (acc_pzs.`id_shop` = o.`id_shop`
|
||||
AND acc_pzs.`id_zone` = country.`id_zone`
|
||||
|
||||
@@ -232,8 +232,8 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('Group Shop association:'),
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
}
|
||||
@@ -290,14 +290,14 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
{
|
||||
// We get all associated shops for all attribute groups, because we will disable group shops
|
||||
// for attributes that the selected attribute group don't support
|
||||
$sql = 'SELECT id_attribute_group, id_group_shop FROM '._DB_PREFIX_.'attribute_group_group_shop';
|
||||
$sql = 'SELECT id_attribute_group, id_shop FROM '._DB_PREFIX_.'attribute_group_shop';
|
||||
$associations = array();
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$associations[$row['id_attribute_group']][] = $row['id_group_shop'];
|
||||
$associations[$row['id_attribute_group']][] = $row['id_shop_group'];
|
||||
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('Group Shop association:'),
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
'values' => Shop::getTree()
|
||||
);
|
||||
|
||||
@@ -585,7 +585,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_cart = (int)$this->context->cart->id;
|
||||
$specific_price->id_shop = 0;
|
||||
$specific_price->id_group_shop = 0;
|
||||
$specific_price->id_shop_group = 0;
|
||||
$specific_price->id_currency = 0;
|
||||
$specific_price->id_country = 0;
|
||||
$specific_price->id_group = 0;
|
||||
|
||||
@@ -195,8 +195,8 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('GroupShop association:'),
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -264,8 +264,8 @@ class AdminGroupsControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('Group Shop association:'),
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -963,7 +963,6 @@ class AdminImportControllerCore extends AdminController
|
||||
{
|
||||
if (Validate::isLoadedObject(new TaxRulesGroup($product->id_tax_rules_group)))
|
||||
{
|
||||
$product->setTaxRulesGroup((int)$product->id_tax_rules_group, true);
|
||||
$address = $this->context->shop->getAddress();
|
||||
$tax_manager = TaxManagerFactory::getManager($address, $product->id_tax_rules_group);
|
||||
$product_tax_calculator = $tax_manager->getTaxCalculator();
|
||||
@@ -1123,9 +1122,10 @@ class AdminImportControllerCore extends AdminController
|
||||
if (Tools::getValue('match_ref') == 1 && $product->reference && Product::existsRefInDatabase($product->reference))
|
||||
{
|
||||
$datas = Db::getInstance()->getRow('
|
||||
SELECT `date_add`, `id_product`
|
||||
FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `reference` = "'.$product->reference.'"
|
||||
SELECT product_shop.`date_add`, p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE p.`reference` = "'.$product->reference.'"
|
||||
');
|
||||
$product->id = (int)$datas['id_product'];
|
||||
$product->date_add = pSQL($datas['date_add']);
|
||||
@@ -1133,7 +1133,11 @@ class AdminImportControllerCore extends AdminController
|
||||
} // Else If id product && id product already in base, trying to update
|
||||
else if ($product->id && Product::existsInDatabase((int)$product->id, 'product'))
|
||||
{
|
||||
$datas = Db::getInstance()->getRow('SELECT `date_add` FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.(int)$product->id);
|
||||
$datas = Db::getInstance()->getRow('
|
||||
SELECT product_shop.`date_add`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE p.`id_product` = '.(int)$product->id);
|
||||
$product->date_add = pSQL($datas['date_add']);
|
||||
$res = $product->update();
|
||||
}
|
||||
@@ -1167,7 +1171,6 @@ class AdminImportControllerCore extends AdminController
|
||||
$shop = trim($shop);
|
||||
if (!is_numeric($shop))
|
||||
$shop = Shop::getIdByName($shop);
|
||||
$product->updateCategoryDefault(new Shop($shop));
|
||||
$shops[] = $shop;
|
||||
}
|
||||
$product->associateTo($shops);
|
||||
@@ -1587,7 +1590,7 @@ class AdminImportControllerCore extends AdminController
|
||||
if (($field_error = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true &&
|
||||
($lang_field_error = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
|
||||
{
|
||||
$customer->id_group_shop = Shop::getGroupFromShop($customer->id_shop);
|
||||
$customer->id_shop_group = Shop::getGroupFromShop($customer->id_shop);
|
||||
|
||||
if ($customer->id && $customer->customerIdExists($customer->id))
|
||||
$res = $customer->update();
|
||||
@@ -1791,10 +1794,10 @@ class AdminImportControllerCore extends AdminController
|
||||
{
|
||||
$shop = trim($shop);
|
||||
if (!is_numeric($shop))
|
||||
$shop = GroupShop::getIdByName($shop);
|
||||
$shop = ShopGroup::getIdByName($shop);
|
||||
$shops[] = $shop;
|
||||
}
|
||||
$manufacturer->associateTo($shops, 'group_shop');
|
||||
$manufacturer->associateTo($shops);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1852,10 +1855,10 @@ class AdminImportControllerCore extends AdminController
|
||||
{
|
||||
$shop = trim($shop);
|
||||
if (!is_numeric($shop))
|
||||
$shop = GroupShop::getIdByName($shop);
|
||||
$shop = ShopGroup::getIdByName($shop);
|
||||
$shops[] = $shop;
|
||||
}
|
||||
$supplier->associateTo($shops, 'group_shop');
|
||||
$supplier->associateTo($shops);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2156,6 +2159,7 @@ class AdminImportControllerCore extends AdminController
|
||||
break;
|
||||
case $this->entities[$this->l('Products')]:
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_shop');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product');
|
||||
@@ -2177,6 +2181,7 @@ class AdminImportControllerCore extends AdminController
|
||||
case $this->entities[$this->l('Combinations')]:
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_shop`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_image`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group`');
|
||||
|
||||
@@ -324,8 +324,8 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('GroupShop association:'),
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1392,7 +1392,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// Create new cart
|
||||
$cart = new Cart();
|
||||
$cart->id_group_shop = $order->id_group_shop;
|
||||
$cart->id_shop_group = $order->id_shop_group;
|
||||
$cart->id_shop = $order->id_shop;
|
||||
$cart->id_customer = $order->id_customer;
|
||||
$cart->id_carrier = $order->id_carrier;
|
||||
@@ -1421,7 +1421,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_shop = 0;
|
||||
$specific_price->id_group_shop = 0;
|
||||
$specific_price->id_shop_group = 0;
|
||||
$specific_price->id_currency = 0;
|
||||
$specific_price->id_country = 0;
|
||||
$specific_price->id_group = 0;
|
||||
|
||||
@@ -246,10 +246,7 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 1 &&
|
||||
(int)Tools::getValue('PS_ADVANCED_STOCK_MANAGEMENT') == 0)
|
||||
{
|
||||
Db::getInstance()->execute(
|
||||
'UPDATE `'._DB_PREFIX_.'product`
|
||||
SET `advanced_stock_management` = 0
|
||||
WHERE `advanced_stock_management` = 1');
|
||||
ObjectModel::updateMultishopTable('Product', array('advanced_stock_management' => 0), '`advanced_stock_management` = 1');
|
||||
|
||||
Db::getInstance()->execute(
|
||||
'UPDATE `'._DB_PREFIX_.'stock_available`
|
||||
@@ -268,12 +265,15 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
$advanced_stock_management = (int)Tools::getValue('UPDATE_ASM_PRODUCTS');
|
||||
|
||||
// updates product table
|
||||
Db::getInstance()->execute(
|
||||
'UPDATE `'._DB_PREFIX_.'product`
|
||||
SET `advanced_stock_management` = '.$advanced_stock_management.'
|
||||
WHERE `advanced_stock_management` = '.($advanced_stock_management == 1 ? 0 : 1).'
|
||||
ObjectModel::updateMultishopTable(
|
||||
'Product',
|
||||
array(
|
||||
'advanced_stock_management' => $advanced_stock_management
|
||||
),
|
||||
'`advanced_stock_management` = '.($advanced_stock_management == 1 ? 0 : 1).'
|
||||
AND `cache_is_pack` = 0
|
||||
AND `is_virtual` = 0');
|
||||
AND `is_virtual` = 0'
|
||||
);
|
||||
|
||||
// updates stock available table
|
||||
Db::getInstance()->execute(
|
||||
@@ -283,9 +283,14 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
ON
|
||||
(
|
||||
p.`id_product` = s.`id_product`
|
||||
AND p.`cache_is_pack` = 0
|
||||
AND p.`is_virtual` = 0
|
||||
AND p.`advanced_stock_management` = '.$advanced_stock_management.'
|
||||
)
|
||||
LEFT JOIN
|
||||
`'._DB_PREFIX_.'product_shop` product_shop
|
||||
ON
|
||||
(
|
||||
product_shop.`cache_is_pack` = 0
|
||||
AND product_shop.`is_virtual` = 0
|
||||
AND product_shop.`advanced_stock_management` = '.$advanced_stock_management.'
|
||||
)
|
||||
SET s.`depends_on_stock` = '.$advanced_stock_management.',
|
||||
s.`quantity` = 0
|
||||
|
||||
@@ -198,13 +198,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
$this->_category = new Category();
|
||||
|
||||
$this->_join = '
|
||||
$this->_join = Shop::addSqlAssociation('product', 'a').'
|
||||
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_.'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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`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`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
|
||||
@@ -444,10 +442,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
&& Pack::duplicate($id_product_old, $product->id)
|
||||
&& 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::duplicateAttachments((int)$id_product_old, (int)$product->id)
|
||||
&& $product->duplicateShops($id_product_old))
|
||||
&& Product::duplicateDownload($id_product_old, $product->id))
|
||||
{
|
||||
if ($product->hasAttributes())
|
||||
Product::updateDefaultAttribute($product->id);
|
||||
@@ -1452,11 +1447,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->object->add())
|
||||
{
|
||||
$this->addCarriers();
|
||||
$this->updateAssoShop((int)$this->object->id);
|
||||
$this->updateAccessories($this->object);
|
||||
$this->updatePackItems($this->object);
|
||||
$this->updateDownloadProduct($this->object);
|
||||
$this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
|
||||
if (empty($this->errors))
|
||||
{
|
||||
@@ -1551,6 +1544,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$object->indexed = 0;
|
||||
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
$object->setFieldsToUpdate((array)Tools::getValue('multishop_check'));
|
||||
|
||||
if ($object->update())
|
||||
{
|
||||
if ($this->isTabSubmitted('Shipping'))
|
||||
@@ -1558,7 +1554,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->isTabSubmitted('Associations'))
|
||||
{
|
||||
$this->updateAccessories($object);
|
||||
$this->updateAssoShop((int)$object->id);
|
||||
}
|
||||
|
||||
if ($this->isTabSubmitted('Accounting'))
|
||||
@@ -1646,74 +1641,123 @@ class AdminProductsControllerCore extends AdminController
|
||||
$default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
/* Check required fields */
|
||||
// Check required fields
|
||||
foreach ($rules['required'] as $field)
|
||||
{
|
||||
if (!$this->isProductFieldUpdated($field))
|
||||
continue;
|
||||
|
||||
if (($value = Tools::getValue($field)) == false && $value != '0')
|
||||
{
|
||||
if (Tools::getValue('id_'.$this->table) && $field == 'passwd')
|
||||
continue;
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
}
|
||||
}
|
||||
|
||||
/* Check multilingual required fields */
|
||||
// Check multilingual required fields
|
||||
foreach ($rules['requiredLang'] as $fieldLang)
|
||||
if (!Tools::getValue($fieldLang.'_'.$default_language->id))
|
||||
if ($this->isProductFieldUpdated($fieldLang, $default_language->id) && !Tools::getValue($fieldLang.'_'.$default_language->id))
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).'</b> '.$this->l('is required at least in').' '.$default_language->name;
|
||||
|
||||
/* Check fields sizes */
|
||||
// Check fields sizes
|
||||
foreach ($rules['size'] as $field => $maxLength)
|
||||
if ($value = Tools::getValue($field) && Tools::strlen($value) > $maxLength)
|
||||
if ($this->isProductFieldUpdated($field) && ($value = Tools::getValue($field)) && Tools::strlen($value) > $maxLength)
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
|
||||
if (Tools::getIsset('description_short'))
|
||||
if (Tools::getIsset('description_short') && $this->isProductFieldUpdated('description_short'))
|
||||
{
|
||||
$saveShort = Tools::getValue('description_short');
|
||||
$_POST['description_short'] = strip_tags(Tools::getValue('description_short'));
|
||||
}
|
||||
|
||||
/* Check description short size without html */
|
||||
// Check description short size without html
|
||||
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
|
||||
if ($limit <= 0) $limit = 400;
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue('description_short_'.$language['id_lang']))
|
||||
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang'])))
|
||||
if (Tools::strlen(strip_tags($value)) > $limit)
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), 'description_short').' ('.$language['name'].')</b> '.$this->l('is too long').' : '.$limit.' '.$this->l('chars max').' ('.$this->l('count now').' '.Tools::strlen(strip_tags($value)).')';
|
||||
/* Check multilingual fields sizes */
|
||||
|
||||
// Check multilingual fields sizes
|
||||
foreach ($rules['sizeLang'] as $fieldLang => $maxLength)
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue($fieldLang.'_'.$language['id_lang']) && Tools::strlen($value) > $maxLength)
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
if (isset($_POST['description_short']))
|
||||
if ($this->isProductFieldUpdated('description_short') && isset($_POST['description_short']))
|
||||
$_POST['description_short'] = $saveShort;
|
||||
|
||||
/* Check fields validity */
|
||||
// Check fields validity
|
||||
foreach ($rules['validate'] as $field => $function)
|
||||
if ($value = Tools::getValue($field))
|
||||
if ($this->isProductFieldUpdated($field) && ($value = Tools::getValue($field)))
|
||||
if (!Validate::$function($value))
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
|
||||
/* Check multilingual fields validity */
|
||||
// Check multilingual fields validity
|
||||
foreach ($rules['validateLang'] as $fieldLang => $function)
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue($fieldLang.'_'.$language['id_lang']))
|
||||
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue($fieldLang.'_'.$language['id_lang'])))
|
||||
if (!Validate::$function($value))
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is invalid');
|
||||
|
||||
/* Categories */
|
||||
$productCats = '';
|
||||
// Categories
|
||||
if (!Tools::isSubmit('categoryBox') || !count(Tools::getValue('categoryBox')))
|
||||
$this->errors[] = $this->l('product must be in at least one Category');
|
||||
|
||||
if (!is_array(Tools::getValue('categoryBox')) || !in_array(Tools::getValue('id_category_default'), Tools::getValue('categoryBox')))
|
||||
$this->errors[] = $this->l('product must be in the default category');
|
||||
|
||||
/* Tags */
|
||||
// Tags
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue('tags_'.$language['id_lang']))
|
||||
if (!Validate::isTagsList($value))
|
||||
$this->errors[] = $this->l('Tags list').' ('.$language['name'].') '.$this->l('is invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a field is edited (if the checkbox is checked)
|
||||
* This method will do something only for multishop with a context all / group
|
||||
*
|
||||
* @param string $field Name of field
|
||||
* @param int $id_lang
|
||||
* @return bool
|
||||
*/
|
||||
protected function isProductFieldUpdated($field, $id_lang = null)
|
||||
{
|
||||
// Cache this condition to improve performances
|
||||
static $is_activated = null;
|
||||
if (is_null($is_activated))
|
||||
$is_activated = Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP;
|
||||
|
||||
if (!$is_activated)
|
||||
return true;
|
||||
|
||||
if (is_null($id_lang))
|
||||
return !empty($_POST['multishop_check'][$field]);
|
||||
else
|
||||
return !empty($_POST['multishop_check'][$field][$id_lang]);
|
||||
}
|
||||
|
||||
/**
|
||||
* If multishop is activated and context is all / group, set to empty all fields values not checked
|
||||
*/
|
||||
protected function cleanMultishopFields()
|
||||
{
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP && $this->display == 'edit')
|
||||
{
|
||||
$this->object = $this->loadObject();
|
||||
foreach (Product::$definition['fields'] as $field => $data)
|
||||
if (!empty($data['shop']) || !empty($data['lang']))
|
||||
{
|
||||
if (is_array($this->object->$field))
|
||||
foreach ($this->object->$field as $k => $v)
|
||||
$this->object->{$field}[$k] = '';
|
||||
else
|
||||
$this->object->$field = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function _removeTaxFromEcotax()
|
||||
{
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate();
|
||||
@@ -2171,9 +2215,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function initToolbarTitle()
|
||||
{
|
||||
parent::initToolbarTitle();
|
||||
if ($product = $this->loadObject(true))
|
||||
if ((bool)$product->id && $this->display != 'list')
|
||||
$this->toolbar_title[2] = $this->toolbar_title[2].' ('.$product->name[$this->context->language->id].')';
|
||||
if ($product = $this->loadObject(true))
|
||||
if ((bool)$product->id && $this->display != 'list')
|
||||
$this->toolbar_title[2] = $this->toolbar_title[2].' ('.$this->product_name.')';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2183,11 +2227,34 @@ class AdminProductsControllerCore extends AdminController
|
||||
*/
|
||||
public function renderForm()
|
||||
{
|
||||
// This nice code (irony) is here to store the product name, because the row after will erase product name in multishop context
|
||||
$this->product_name = $this->object->name[$this->context->language->id];
|
||||
|
||||
$this->cleanMultishopFields();
|
||||
if (!method_exists($this, 'initForm'.$this->tab_display))
|
||||
return;
|
||||
|
||||
$product = $this->object;
|
||||
|
||||
// Product for multishop
|
||||
$this->context->smarty->assign('bullet_common_field', '');
|
||||
if (Shop::isFeatureActive() && $this->display == 'edit')
|
||||
{
|
||||
if (Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'display_multishop_checkboxes' => true,
|
||||
'multishop_check' => Tools::getValue('multishop_check'),
|
||||
));
|
||||
}
|
||||
|
||||
if (Shop::getContext() != Shop::CONTEXT_ALL)
|
||||
{
|
||||
$this->context->smarty->assign('bullet_common_field', '<img src="themes/'.$this->context->employee->bo_theme.'/img/bullet_orange.png" style="vertical-align: bottom" />');
|
||||
$this->context->smarty->assign('display_common_field', true);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the tabs that need to be preloaded by their priority number
|
||||
asort($this->available_tabs, SORT_NUMERIC);
|
||||
$this->tpl_form_vars['tabs_preloaded'] = $this->available_tabs;
|
||||
@@ -2199,6 +2266,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tpl_form_vars['defaultLanguage'] = Language::getLanguage(Configuration::get('PS_LANG_DEFAULT'));
|
||||
|
||||
$this->tpl_form_vars['currentIndex'] = self::$currentIndex;
|
||||
$this->tpl_form_vars['display_multishop_checkboxes'] = (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP && $this->display == 'edit');
|
||||
$this->fields_form = array('');
|
||||
$this->display = 'edit';
|
||||
$this->tpl_form_vars['token'] = $this->token;
|
||||
@@ -2407,14 +2475,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if ((int)$attribute['id_product_attribute'] > 0)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'product_attribute
|
||||
SET supplier_reference = "'.pSQL($reference).'",
|
||||
wholesale_price = '.(float)Tools::convertPrice($price, $id_currency).'
|
||||
WHERE id_product = '.(int)$product->id.'
|
||||
AND id_product_attribute = '.(int)$attribute['id_product_attribute'].'
|
||||
LIMIT 1
|
||||
');
|
||||
$data = array(
|
||||
'supplier_reference' => pSQL($reference),
|
||||
'wholesale_price' => (float)Tools::convertPrice($price, $id_currency)
|
||||
);
|
||||
$where = '
|
||||
id_product = '.(int)$product->id.'
|
||||
AND id_product_attribute = '.(int)$attribute['id_product_attribute'];
|
||||
ObjectModel::updateMultishopTable('product_attribute', $data, $where);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2608,8 +2676,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
$helper->table = $this->table;
|
||||
$helper->identifier = $this->identifier;
|
||||
|
||||
$data->assign('displayAssoShop', $helper->renderAssoShop());
|
||||
|
||||
// Accessories block
|
||||
$accessories = Product::getAccessoriesLight($this->context->language->id, $product->id);
|
||||
|
||||
@@ -3234,12 +3300,18 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$data->assign('product_type', (int)Tools::getValue('type_product', $product->getType()));
|
||||
|
||||
$check_product_association_ajax = false;
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL)
|
||||
$check_product_association_ajax = true;
|
||||
|
||||
// TinyMCE
|
||||
$iso_tiny_mce = $this->context->language->iso_code;
|
||||
$iso_tiny_mce = (file_exists(_PS_JS_DIR_.'tiny_mce/langs/'.$iso_tiny_mce.'.js') ? $iso_tiny_mce : 'en');
|
||||
$data->assign('ad', dirname($_SERVER['PHP_SELF']));
|
||||
$data->assign('iso_tiny_mce', $iso_tiny_mce);
|
||||
$category_box = Tools::getValue('categoryBox', array());
|
||||
$data->assign('check_product_association_ajax', $check_product_association_ajax);
|
||||
$data->assign('id_lang', $this->context->language->id);
|
||||
$data->assign('product', $product);
|
||||
$data->assign('token', $this->token);
|
||||
$data->assign('currency', $currency);
|
||||
@@ -3583,7 +3655,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$show_quantities = true;
|
||||
$shop_context = Shop::getContext();
|
||||
$group_shop = $this->context->shop->getGroup();
|
||||
$shop_group = $this->context->shop->getGroup();
|
||||
|
||||
// if we are in all shops context, it's not possible to manage quantities at this level
|
||||
if ($shop_context == Shop::CONTEXT_ALL)
|
||||
@@ -3592,14 +3664,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
elseif ($shop_context == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
// if quantities are not shared between shops of the group, it's not possible to manage them at group level
|
||||
if (!$group_shop->share_stock)
|
||||
if (!$shop_group->share_stock)
|
||||
$show_quantities = false;
|
||||
}
|
||||
// if we are in shop context
|
||||
else
|
||||
{
|
||||
// if quantities are shared between shops of the group, it's not possible to manage them for a given shop
|
||||
if ($group_shop->share_stock)
|
||||
if ($shop_group->share_stock)
|
||||
$show_quantities = false;
|
||||
}
|
||||
|
||||
@@ -4047,7 +4119,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
_PS_JS_DIR_.'jquery/plugins/treeview/jquery.treeview.async.js',
|
||||
_PS_JS_DIR_.'jquery/plugins/treeview/jquery.treeview.edit.js',
|
||||
_PS_JS_DIR_.'admin-categories-tree.js',
|
||||
_PS_JS_DIR_.'/jquery/ui/jquery.ui.progressbar.min.js',
|
||||
_PS_JS_DIR_.'jquery/ui/jquery.ui.progressbar.min.js',
|
||||
_PS_JS_DIR_.'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'
|
||||
));
|
||||
|
||||
@@ -4074,42 +4146,19 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tpl_form_vars['warning_unavailable_product'] = $content;
|
||||
}
|
||||
|
||||
protected function updateAssoShop($id_object = false, $new_id_object = false)
|
||||
public function ajaxProcessCheckProductName()
|
||||
{
|
||||
$assos_data = $this->getAssoShop($this->table, $id_object);
|
||||
$assos = $assos_data[0];
|
||||
$type = $assos_data[1];
|
||||
|
||||
$product_shop = Product::getShopsByProduct($id_object);
|
||||
|
||||
if (!$type)
|
||||
return;
|
||||
|
||||
if ($new_id_object)
|
||||
$object = new Product($new_id_object);
|
||||
else
|
||||
$object = new Product($id_object);
|
||||
$delete = $insert = '';
|
||||
foreach ($assos as $asso)
|
||||
{
|
||||
$passed = false;
|
||||
$delete .= (int)$asso['id_'.$type].',';
|
||||
foreach ($product_shop as $product)
|
||||
if ($product['id_shop'] == $asso['id_'.$type])
|
||||
$passed = true;
|
||||
if (!$passed)
|
||||
$insert .= '('.($new_id_object ? (int)$new_id_object : (int)$asso['id_object']).', '.(int)$asso['id_'.$type].', '.(int)$object->id_category_default.'),';
|
||||
$search = Tools::getValue('q');
|
||||
$id_lang = Tools::getValue('id_lang');
|
||||
$limit = Tools::getValue('limit');
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT DISTINCT pl.`name`, p.`id_product`, pl.`id_shop`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE pl.`name` LIKE "%'.pSQL($search).'%"
|
||||
GROUP BY pl.`id_product`
|
||||
LIMIT '.(int)$limit);
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
$delete = rtrim($delete, ',');
|
||||
$insert = rtrim($insert, ',');
|
||||
|
||||
if (!empty($delete))
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.
|
||||
($id_object ? ' WHERE `'.$this->identifier.'` = '.(int)$id_object.' AND `id_'.$type.'` NOT IN ('.$delete.')' : ''));
|
||||
|
||||
if (!empty($insert))
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO '._DB_PREFIX_.$this->table.'_'.$type.' (`'.pSQL($this->identifier).'`, `id_'.$type.'`, `id_category_default`)
|
||||
VALUES '.pSQL($insert));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class AdminSearchConfControllerCore extends AdminController
|
||||
$cron_url = Tools::getHttpHost(true, true).__PS_BASE_URI__.
|
||||
substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -strlen($current_file_name['0'])).
|
||||
'searchcron.php?full=1&token='.substr(_COOKIE_KEY_, 34, 8);
|
||||
list($total, $indexed) = Db::getInstance()->getRow('SELECT COUNT(*) as "0", SUM(indexed) as "1" FROM '._DB_PREFIX_.'product');
|
||||
list($total, $indexed) = Db::getInstance()->getRow('SELECT COUNT(*) as "0", SUM(product_shop.indexed) as "1" FROM '._DB_PREFIX_.'product p '.Shop::addSqlAssociation('product', 'p'));
|
||||
|
||||
$this->fields_options = array(
|
||||
'indexation' => array(
|
||||
|
||||
@@ -47,7 +47,7 @@ class AdminShopControllerCore extends AdminController
|
||||
'filter_key' => 'a!name',
|
||||
'width' => 200,
|
||||
),
|
||||
'group_shop_name' => array(
|
||||
'shop_group_name' => array(
|
||||
'title' => $this->l('Group Shop'),
|
||||
'width' => 150,
|
||||
'filter_key' => 'gs!name'
|
||||
@@ -154,10 +154,10 @@ class AdminShopControllerCore extends AdminController
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->_select = 'gs.name group_shop_name, cl.name category_name, CONCAT(\'http://\', su.domain, su.physical_uri, su.virtual_uri) AS url';
|
||||
$this->_select = 'gs.name shop_group_name, cl.name category_name, CONCAT(\'http://\', su.domain, su.physical_uri, su.virtual_uri) AS url';
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_shop` gs
|
||||
ON (a.id_group_shop = gs.id_group_shop)
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop_group` gs
|
||||
ON (a.id_shop_group = gs.id_shop_group)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$this->context->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su
|
||||
@@ -237,7 +237,7 @@ class AdminShopControllerCore extends AdminController
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$this->_where .= ' AND a.id_group_shop = '.(int)Shop::getContextGroupShopID();
|
||||
$this->_where .= ' AND a.id_shop_group = '.(int)Shop::getContextShopGroupID();
|
||||
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
$shop_delete_list = array();
|
||||
@@ -272,35 +272,35 @@ class AdminShopControllerCore extends AdminController
|
||||
|
||||
if (Shop::getTotalShops() > 1 && $obj->id)
|
||||
{
|
||||
$group_shop = new GroupShop($obj->id_group_shop);
|
||||
$shop_group = new ShopGroup($obj->id_shop_group);
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_group_shop',
|
||||
'default' => $group_shop->name
|
||||
'name' => 'id_shop_group',
|
||||
'default' => $shop_group->name
|
||||
);
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'textGroupShop',
|
||||
'type' => 'textShopGroup',
|
||||
'label' => $this->l('Group Shop:'),
|
||||
'name' => 'id_group_shop',
|
||||
'value' => $group_shop->name
|
||||
'name' => 'id_shop_group',
|
||||
'value' => $shop_group->name
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$options = array();
|
||||
foreach (GroupShop::getGroupShops() as $group)
|
||||
foreach (ShopGroup::getShopGroups() as $group)
|
||||
$options[] = array(
|
||||
'id_group_shop' => $group->id,
|
||||
'id_shop_group' => $group->id,
|
||||
'name' => $group->name,
|
||||
);
|
||||
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Group Shop:'),
|
||||
'name' => 'id_group_shop',
|
||||
'name' => 'id_shop_group',
|
||||
'options' => array(
|
||||
'query' => $options,
|
||||
'id' => 'id_group_shop',
|
||||
'id' => 'id_shop_group',
|
||||
'name' => 'name',
|
||||
),
|
||||
);
|
||||
@@ -431,10 +431,10 @@ class AdminShopControllerCore extends AdminController
|
||||
);
|
||||
|
||||
$this->fields_value = array(
|
||||
'id_group_shop' => (Tools::getValue('id_group_shop') ? Tools::getValue('id_group_shop') :
|
||||
(isset($obj->id_group_shop)) ? $obj->id_group_shop : Shop::getContextGroupShopID()),
|
||||
'id_shop_group' => (Tools::getValue('id_shop_group') ? Tools::getValue('id_shop_group') :
|
||||
(isset($obj->id_shop_group)) ? $obj->id_shop_group : Shop::getContextShopGroupID()),
|
||||
'id_category' => (Tools::getValue('id_category') ? Tools::getValue('id_category') :
|
||||
(isset($obj->id_group_shop)) ? $obj->id_group_shop : Shop::getContextGroupShopID()),
|
||||
(isset($obj->id_shop_group)) ? $obj->id_shop_group : Shop::getContextShopGroupID()),
|
||||
'id_theme_checked' => (isset($obj->id_theme) ? $obj->id_theme : $id_theme)
|
||||
);
|
||||
|
||||
|
||||
+22
-56
@@ -25,12 +25,12 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminGroupShopControllerCore extends AdminController
|
||||
class AdminShopGroupControllerCore extends AdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'group_shop';
|
||||
$this->className = 'GroupShop';
|
||||
$this->table = 'shop_group';
|
||||
$this->className = 'ShopGroup';
|
||||
$this->lang = false;
|
||||
$this->requiredDatabase = true;
|
||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
||||
@@ -46,7 +46,7 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
$this->deleted = false;
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_group_shop' => array(
|
||||
'id_shop_group' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 25,
|
||||
@@ -74,12 +74,12 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('GroupShop')
|
||||
'title' => $this->l('ShopGroup')
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('GroupShop name:'),
|
||||
'label' => $this->l('Shop group name:'),
|
||||
'name' => 'name',
|
||||
'required' => true
|
||||
),
|
||||
@@ -200,60 +200,32 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
'zone' => $this->l('Zones'),
|
||||
);
|
||||
|
||||
if (!$this->object->id)
|
||||
$this->fields_import_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Import data from another group shop')
|
||||
),
|
||||
'label' => $this->l('Duplicate data from group shop'),
|
||||
'checkbox' => array(
|
||||
'type' => 'checkbox',
|
||||
'label' => $this->l('Duplicate data from group shop'),
|
||||
'name' => 'useImportData',
|
||||
'value' => 1
|
||||
),
|
||||
'select' => array(
|
||||
'type' => 'select',
|
||||
'name' => 'importFromShop',
|
||||
'options' => array(
|
||||
'query' => Shop::getTree(),
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
'allcheckbox' => array(
|
||||
'type' => 'checkbox',
|
||||
'values' => $import_data
|
||||
),
|
||||
'desc' => $this->l('Use this option to associate data (products, modules, etc.) the same way as the selected shop')
|
||||
);
|
||||
|
||||
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
$this->tpl_form_vars = array(
|
||||
'disabled' => $disabled,
|
||||
'checked' => (Tools::getValue('addgroup_shop') !== false) ? true : false,
|
||||
'defaultGroup' => $default_shop->id_group_shop,
|
||||
'checked' => (Tools::getValue('addshop_group') !== false) ? true : false,
|
||||
'defaultGroup' => $default_shop->id_shop_group,
|
||||
);
|
||||
if (isset($this->fields_import_form))
|
||||
$this->tpl_form_vars = array_merge($this->tpl_form_vars, array('form_import' => $this->fields_import_form));
|
||||
|
||||
$this->fields_value = array(
|
||||
'active' => true
|
||||
);
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
$group_shop_delete_list = array();
|
||||
$shop_group_delete_list = array();
|
||||
|
||||
// test store authorized to remove
|
||||
foreach ($this->_list as $group_shop)
|
||||
foreach ($this->_list as $shop_group)
|
||||
{
|
||||
$shops = Shop::getShops(true, $group_shop['id_group_shop']);
|
||||
$shops = Shop::getShops(true, $shop_group['id_shop_group']);
|
||||
if (!empty($shops))
|
||||
$group_shop_delete_list[] = $group_shop['id_group_shop'];
|
||||
$shop_group_delete_list[] = $shop_group['id_shop_group'];
|
||||
}
|
||||
$this->addRowActionSkipList('delete', $group_shop_delete_list);
|
||||
$this->addRowActionSkipList('delete', $shop_group_delete_list);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
@@ -261,10 +233,10 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
if (Tools::isSubmit('delete'.$this->table) || Tools::isSubmit('status') || Tools::isSubmit('status'.$this->table))
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
if (GroupShop::getTotalGroupShops() == 1)
|
||||
$this->errors[] = Tools::displayError('You cannot delete or disable the last groupshop.');
|
||||
if (ShopGroup::getTotalShopGroup() == 1)
|
||||
$this->errors[] = Tools::displayError('You cannot delete or disable the last shop group.');
|
||||
else if ($object->haveShops())
|
||||
$this->errors[] = Tools::displayError('You cannot delete or disable a groupshop which has shops using it.');
|
||||
$this->errors[] = Tools::displayError('You cannot delete or disable a shop group which has shops using it.');
|
||||
|
||||
if (count($this->errors))
|
||||
return false;
|
||||
@@ -272,22 +244,16 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
protected function afterAdd($new_group_shop)
|
||||
protected function afterAdd($new_shop_group)
|
||||
{
|
||||
if (Tools::getValue('useImportData') && ($import_data = Tools::getValue('importData')) && is_array($import_data))
|
||||
$new_group_shop->copyGroupShopData(Tools::getValue('importFromShop'), $import_data);
|
||||
|
||||
//Reset available quantitites
|
||||
StockAvailable::resetProductFromStockAvailableByGroupShop($new_group_shop);
|
||||
StockAvailable::resetProductFromStockAvailableByShopGroup($new_shop_group);
|
||||
}
|
||||
|
||||
protected function afterUpdate($new_group_shop)
|
||||
protected function afterUpdate($new_shop_group)
|
||||
{
|
||||
if (Tools::getValue('useImportData') && ($import_data = Tools::getValue('importData')) && is_array($import_data))
|
||||
$new_group_shop->copyGroupShopData(Tools::getValue('importFromShop'), $import_data);
|
||||
|
||||
//Reset available quantitites
|
||||
StockAvailable::resetProductFromStockAvailableByGroupShop($new_group_shop);
|
||||
StockAvailable::resetProductFromStockAvailableByShopGroup($new_shop_group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@ class AdminStockCoverControllerCore extends AdminController
|
||||
// query
|
||||
$this->_select = 'a.id_product as id, COUNT(pa.id_product_attribute) as variations, SUM(s.usable_quantity) as stock';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
INNER JOIN `'._DB_PREFIX_.'stock` s ON (s.id_product = a.id_product)';
|
||||
|
||||
self::$currentIndex .= '&coverage_period='.(int)$this->getCurrentCoveragePeriod().'&warn_days='.(int)$this->getCurrentWarning();
|
||||
|
||||
@@ -100,7 +100,7 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
|
||||
// overrides query
|
||||
$this->_select = 'a.id_product as id, COUNT(pa.id_product_attribute) as variations';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)'.Shop::addSqlAssociation('product_attribute', 'pa');
|
||||
$this->_where = 'AND a.cache_is_pack = 0 AND a.is_virtual = 0';
|
||||
$this->_group = 'GROUP BY a.id_product';
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
|
||||
@@ -111,7 +111,7 @@ class AdminZonesControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Group shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
|
||||
@@ -53,7 +53,7 @@ class ManufacturerControllerCore extends FrontController
|
||||
if ($id_manufacturer = Tools::getValue('id_manufacturer'))
|
||||
{
|
||||
$this->manufacturer = new Manufacturer((int)$id_manufacturer, $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($this->manufacturer) || !$this->manufacturer->active || !$this->manufacturer->isAssociatedToGroupShop())
|
||||
if (!Validate::isLoadedObject($this->manufacturer) || !$this->manufacturer->active || !$this->manufacturer->isAssociatedToShop())
|
||||
{
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
header('Status: 404 Not Found');
|
||||
@@ -72,7 +72,7 @@ class ManufacturerControllerCore extends FrontController
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
if (Validate::isLoadedObject($this->manufacturer) && $this->manufacturer->active && $this->manufacturer->isAssociatedToGroupShop())
|
||||
if (Validate::isLoadedObject($this->manufacturer) && $this->manufacturer->active && $this->manufacturer->isAssociatedToShop())
|
||||
{
|
||||
$this->productSort();
|
||||
$this->assignOne();
|
||||
@@ -106,8 +106,8 @@ class ManufacturerControllerCore extends FrontController
|
||||
{
|
||||
if (Configuration::get('PS_DISPLAY_SUPPLIERS'))
|
||||
{
|
||||
$id_current_group_shop = Shop::getContextGroupShopID();
|
||||
$data = Manufacturer::getManufacturers(true, $this->context->language->id, true, false, false, false, $id_current_group_shop);
|
||||
$id_current_shop_group = Shop::getContextShopGroupID();
|
||||
$data = Manufacturer::getManufacturers(true, $this->context->language->id, true, false, false, false, $id_current_shop_group);
|
||||
$nbProducts = count($data);
|
||||
$this->pagination($nbProducts);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class SupplierControllerCore extends FrontController
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToGroupShop())
|
||||
if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToShop())
|
||||
{
|
||||
$this->productSort(); // productSort must be called before assignOne
|
||||
$this->assignOne();
|
||||
|
||||
+11
-13
@@ -1730,6 +1730,10 @@ a.blue:hover {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.multishop_product_checkbox{
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
a.action_module_delete {
|
||||
color: #CB1C00;
|
||||
text-decoration: underline;
|
||||
@@ -1796,19 +1800,9 @@ p.preference_description .light-warning {
|
||||
}
|
||||
|
||||
.preference_default_multishop{
|
||||
float: right;
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
.preference_default_multishop input{
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
.preference_default_multishop label{
|
||||
float: none;
|
||||
font-size: 12px;
|
||||
color: #666666;
|
||||
font-style: italic;
|
||||
float: left;
|
||||
padding-right: 5px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.multishop_warning, .warning_mod_rewrite{
|
||||
@@ -1820,6 +1814,10 @@ p.preference_description .light-warning {
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
label.conf_title{
|
||||
width: 235px;
|
||||
}
|
||||
|
||||
.isDisabled{
|
||||
}
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ class InstallXmlLoader
|
||||
{
|
||||
$table = current($row);
|
||||
if (preg_match('#^'._DB_PREFIX_.'(.+?)(_lang)?$#i', $table, $m))
|
||||
if (preg_match('#^'._DB_PREFIX_.'(.+?)(_group_shop|_shop)$#i', $table, $m2) && !isset($tables[$m2[1]]))
|
||||
if (preg_match('#^'._DB_PREFIX_.'(.+?)_shop$#i', $table, $m2) && !isset($tables[$m2[1]]))
|
||||
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
|
||||
else
|
||||
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
|
||||
|
||||
@@ -167,7 +167,7 @@ CREATE TABLE `PREFIX_carrier_zone` (
|
||||
|
||||
CREATE TABLE `PREFIX_cart` (
|
||||
`id_cart` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_carrier` int(10) unsigned NOT NULL,
|
||||
`delivery_option` varchar(100),
|
||||
@@ -192,7 +192,7 @@ CREATE TABLE `PREFIX_cart` (
|
||||
KEY `id_lang` (`id_lang`),
|
||||
KEY `id_currency` (`id_currency`),
|
||||
KEY `id_guest` (`id_guest`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -414,7 +414,7 @@ CREATE TABLE `PREFIX_compare_product` (
|
||||
|
||||
CREATE TABLE `PREFIX_configuration` (
|
||||
`id_configuration` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_group_shop` INT(11) UNSIGNED DEFAULT NULL,
|
||||
`id_shop_group` INT(11) UNSIGNED DEFAULT NULL,
|
||||
`id_shop` INT(11) UNSIGNED DEFAULT NULL,
|
||||
`name` varchar(32) NOT NULL,
|
||||
`value` text,
|
||||
@@ -423,7 +423,7 @@ CREATE TABLE `PREFIX_configuration` (
|
||||
PRIMARY KEY (`id_configuration`),
|
||||
KEY `name` (`name`),
|
||||
KEY `id_shop` (`id_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
KEY `id_shop_group` (`id_shop_group`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_configuration_lang` (
|
||||
@@ -436,7 +436,7 @@ CREATE TABLE `PREFIX_configuration_lang` (
|
||||
|
||||
CREATE TABLE `PREFIX_connections` (
|
||||
`id_connections` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_guest` int(10) unsigned NOT NULL,
|
||||
`id_page` int(10) unsigned NOT NULL,
|
||||
@@ -528,7 +528,7 @@ CREATE TABLE `PREFIX_currency` (
|
||||
|
||||
CREATE TABLE `PREFIX_customer` (
|
||||
`id_customer` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_gender` int(10) unsigned NOT NULL,
|
||||
`id_default_group` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
@@ -563,7 +563,7 @@ CREATE TABLE `PREFIX_customer` (
|
||||
KEY `customer_login` (`email`,`passwd`),
|
||||
KEY `id_customer_passwd` (`id_customer`,`passwd`),
|
||||
KEY `id_gender` (`id_gender`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -667,7 +667,7 @@ CREATE TABLE `PREFIX_date_range` (
|
||||
CREATE TABLE `PREFIX_delivery` (
|
||||
`id_delivery` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_shop` INT UNSIGNED NULL DEFAULT NULL,
|
||||
`id_group_shop` INT UNSIGNED NULL DEFAULT NULL,
|
||||
`id_shop_group` INT UNSIGNED NULL DEFAULT NULL,
|
||||
`id_carrier` int(10) unsigned NOT NULL,
|
||||
`id_range_price` int(10) unsigned default NULL,
|
||||
`id_range_weight` int(10) unsigned default NULL,
|
||||
@@ -1022,7 +1022,7 @@ CREATE TABLE `PREFIX_operating_system` (
|
||||
CREATE TABLE `PREFIX_orders` (
|
||||
`id_order` int(10) unsigned NOT NULL auto_increment,
|
||||
`reference` VARCHAR(9),
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_carrier` int(10) unsigned NOT NULL,
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
@@ -1072,7 +1072,7 @@ CREATE TABLE `PREFIX_orders` (
|
||||
KEY `id_currency` (`id_currency`),
|
||||
KEY `id_address_delivery` (`id_address_delivery`),
|
||||
KEY `id_address_invoice` (`id_address_invoice`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_shop` (`id_shop`),
|
||||
INDEX `date_add`(`date_add`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
@@ -1308,7 +1308,7 @@ CREATE TABLE `PREFIX_page_type` (
|
||||
|
||||
CREATE TABLE `PREFIX_page_viewed` (
|
||||
`id_page` int(10) unsigned NOT NULL,
|
||||
`id_group_shop` INT UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop_group` INT UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_date_range` int(10) unsigned NOT NULL,
|
||||
`counter` int(10) unsigned NOT NULL,
|
||||
@@ -1338,6 +1338,7 @@ CREATE TABLE `PREFIX_product` (
|
||||
`id_supplier` int(10) unsigned default NULL,
|
||||
`id_manufacturer` int(10) unsigned default NULL,
|
||||
`id_category_default` int(10) unsigned default NULL,
|
||||
`id_tax_rules_group` INT(11) UNSIGNED NOT NULL,
|
||||
`on_sale` tinyint(1) unsigned NOT NULL default '0',
|
||||
`online_only` tinyint(1) unsigned NOT NULL default '0',
|
||||
`ean13` varchar(13) default NULL,
|
||||
@@ -1383,6 +1384,38 @@ CREATE TABLE `PREFIX_product` (
|
||||
KEY `date_add` (`date_add`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_product_shop` (
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`id_category_default` int(10) unsigned DEFAULT NULL,
|
||||
`id_tax_rules_group` INT(11) UNSIGNED NOT NULL,
|
||||
`on_sale` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`online_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
|
||||
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`unity` varchar(255) DEFAULT NULL,
|
||||
`unit_price_ratio` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`additional_shipping_cost` decimal(20,2) NOT NULL DEFAULT '0.00',
|
||||
`customizable` tinyint(2) NOT NULL DEFAULT '0',
|
||||
`text_fields` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`available_for_order` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`available_date` date NOT NULL,
|
||||
`condition` enum('new','used','refurbished') NOT NULL DEFAULT 'new',
|
||||
`show_price` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`indexed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`visibility` enum('both','catalog','search','none') NOT NULL DEFAULT 'both',
|
||||
`cache_default_attribute` int(10) unsigned DEFAULT NULL,
|
||||
`advanced_stock_management` tinyint(1) default '0' NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_product`, `id_shop`),
|
||||
KEY `id_category_default` (`id_category_default`),
|
||||
KEY `date_add` (`date_add`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_product_attribute` (
|
||||
`id_product_attribute` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
@@ -1408,6 +1441,19 @@ CREATE TABLE `PREFIX_product_attribute` (
|
||||
KEY `id_product_id_product_attribute` (`id_product_attribute` , `id_product`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_product_attribute_shop` (
|
||||
`id_product_attribute` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`wholesale_price` decimal(20,6) NOT NULL default '0.000000',
|
||||
`price` decimal(20,6) NOT NULL default '0.000000',
|
||||
`ecotax` decimal(17,6) NOT NULL default '0.00',
|
||||
`unit_price_impact` decimal(17,2) NOT NULL default '0.00',
|
||||
`default_on` tinyint(1) unsigned NOT NULL default '0',
|
||||
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`available_date` date NOT NULL,
|
||||
PRIMARY KEY (`id_product_attribute`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_product_attribute_combination` (
|
||||
`id_attribute` int(10) unsigned NOT NULL,
|
||||
`id_product_attribute` int(10) unsigned NOT NULL,
|
||||
@@ -1620,7 +1666,7 @@ CREATE TABLE `PREFIX_specific_price` (
|
||||
`id_cart` INT(11) UNSIGNED NOT NULL,
|
||||
`id_product` INT UNSIGNED NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop_group` INT(11) UNSIGNED NOT NULL,
|
||||
`id_currency` INT UNSIGNED NOT NULL,
|
||||
`id_country` INT UNSIGNED NOT NULL,
|
||||
`id_group` INT UNSIGNED NOT NULL,
|
||||
@@ -1866,27 +1912,27 @@ CREATE TABLE `PREFIX_import_match` (
|
||||
PRIMARY KEY (`id_import_match`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_group_shop` (
|
||||
`id_group_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_shop_group` (
|
||||
`id_shop_group` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`share_customer` TINYINT(1) NOT NULL,
|
||||
`share_order` TINYINT(1) NOT NULL,
|
||||
`share_stock` TINYINT(1) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_group_shop`)
|
||||
PRIMARY KEY (`id_shop_group`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_shop` (
|
||||
`id_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_group_shop` int(11) unsigned NOT NULL,
|
||||
`id_shop_group` int(11) unsigned NOT NULL,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`id_category` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_theme` INT(1) UNSIGNED NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_category` (`id_category`),
|
||||
KEY `id_theme` (`id_theme`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
@@ -1976,60 +2022,60 @@ CREATE TABLE `PREFIX_image_shop` (
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_attribute_group_shop` (
|
||||
CREATE TABLE `PREFIX_attribute_shop` (
|
||||
`id_attribute` INT(11) UNSIGNED NOT NULL,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_attribute`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_attribute`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_feature_group_shop` (
|
||||
CREATE TABLE `PREFIX_feature_shop` (
|
||||
`id_feature` INT(11) UNSIGNED NOT NULL,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_feature`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_feature`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_group_group_shop` (
|
||||
CREATE TABLE `PREFIX_group_shop` (
|
||||
`id_group` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_group_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_group`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_attribute_group_group_shop` (
|
||||
CREATE TABLE `PREFIX_attribute_group_shop` (
|
||||
`id_attribute_group` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_group_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_attribute_group`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_attribute_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_tax_rules_group_group_shop` (
|
||||
CREATE TABLE `PREFIX_tax_rules_group_shop` (
|
||||
`id_tax_rules_group` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_group_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_tax_rules_group`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_tax_rules_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_zone_group_shop` (
|
||||
CREATE TABLE `PREFIX_zone_shop` (
|
||||
`id_zone` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_group_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_zone`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_zone`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_manufacturer_group_shop` (
|
||||
CREATE TABLE `PREFIX_manufacturer_shop` (
|
||||
`id_manufacturer` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_group_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_manufacturer`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_manufacturer`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_supplier_group_shop` (
|
||||
CREATE TABLE `PREFIX_supplier_shop` (
|
||||
`id_supplier` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_group_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_supplier`, `id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`)
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_supplier`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_store_shop` (
|
||||
@@ -2039,14 +2085,6 @@ PRIMARY KEY (`id_store`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_product_shop` (
|
||||
`id_product` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_category_default` INT( 11 ) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY ( `id_shop` , `id_product` ),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_module_shop` (
|
||||
`id_module` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
@@ -2165,13 +2203,13 @@ CREATE TABLE `PREFIX_stock_available` (
|
||||
`id_product` INT(11) UNSIGNED NOT NULL,
|
||||
`id_product_attribute` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop_group` INT(11) UNSIGNED NOT NULL,
|
||||
`quantity` INT(10) NOT NULL DEFAULT '0',
|
||||
`depends_on_stock` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`out_of_stock` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_stock_available`),
|
||||
KEY `id_shop` (`id_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_product` (`id_product`),
|
||||
KEY `id_product_attribute` (`id_product_attribute`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
@@ -2291,15 +2329,6 @@ CREATE TABLE `PREFIX_product_supplier` (
|
||||
UNIQUE KEY `id_product` (`id_product`,`id_product_attribute`,`id_supplier`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_supplier_rates` (
|
||||
`id_product_supplier` INT(11) UNSIGNED NOT NULL,
|
||||
`id_currency` INT(11) UNSIGNED NOT NULL,
|
||||
`quantity_min` INT(11) UNSIGNED NOT NULL,
|
||||
`quantity_max` INT(11) UNSIGNED NOT NULL,
|
||||
`price_te` DECIMAL(20,6) DEFAULT '0.000000',
|
||||
PRIMARY KEY (`id_product_supplier`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_accounting_export` (
|
||||
`id_accounting_export` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`begin_to` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
@@ -2410,13 +2439,6 @@ CREATE TABLE `PREFIX_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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_configuration>
|
||||
<fields id="name" sql="a.name <> 'PS_LANG_DEFAULT' AND a.id_shop IS NULL AND a.id_group_shop IS NULL" null="1">
|
||||
<fields id="name" sql="a.name <> 'PS_LANG_DEFAULT' AND a.id_shop IS NULL AND a.id_shop_group IS NULL" null="1">
|
||||
<field name="name"/>
|
||||
<field name="value"/>
|
||||
</fields>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<entity_delivery>
|
||||
<fields class="Delivery" sql="a.id_carrier = 1">
|
||||
<field name="id_shop"/>
|
||||
<field name="id_group_shop"/>
|
||||
<field name="id_shop_group"/>
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_range_price" relation="range_price"/>
|
||||
<field name="id_range_weight" relation="range_weight"/>
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
<class_name>AdminShop</class_name>
|
||||
</tab>
|
||||
<tab id="Group_Shops" id_parent="Shops" active="1">
|
||||
<class_name>AdminGroupShop</class_name>
|
||||
<class_name>AdminShopGroup</class_name>
|
||||
</tab>
|
||||
<tab id="Shop_Urls" id_parent="Shops" active="1">
|
||||
<class_name>AdminShopUrl</class_name>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<entity_delivery>
|
||||
<fields class="Delivery" sql="a.id_carrier > 1" null="1">
|
||||
<field name="id_shop"/>
|
||||
<field name="id_group_shop"/>
|
||||
<field name="id_shop_group"/>
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_range_price" relation="range_price"/>
|
||||
<field name="id_range_weight" relation="range_weight"/>
|
||||
@@ -10,9 +10,9 @@
|
||||
<field name="price"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<delivery id="delivery_1" id_shop="" id_group_shop="" id_carrier="My_carrier" id_range_price="" id_range_weight="range_weight_1" id_zone="Europe" price="5.000000"/>
|
||||
<delivery id="delivery_2" id_shop="" id_group_shop="" id_carrier="My_carrier" id_range_price="" id_range_weight="range_weight_1" id_zone="North_America" price="5.000000"/>
|
||||
<delivery id="delivery_4" id_shop="" id_group_shop="" id_carrier="My_carrier" id_range_price="range_price_1" id_range_weight="" id_zone="Europe" price="5.000000"/>
|
||||
<delivery id="delivery_5" id_shop="" id_group_shop="" id_carrier="My_carrier" id_range_price="range_price_1" id_range_weight="" id_zone="North_America" price="5.000000"/>
|
||||
<delivery id="delivery_1" id_shop="" id_shop_group="" id_carrier="My_carrier" id_range_price="" id_range_weight="range_weight_1" id_zone="Europe" price="5.000000"/>
|
||||
<delivery id="delivery_2" id_shop="" id_shop_group="" id_carrier="My_carrier" id_range_price="" id_range_weight="range_weight_1" id_zone="North_America" price="5.000000"/>
|
||||
<delivery id="delivery_4" id_shop="" id_shop_group="" id_carrier="My_carrier" id_range_price="range_price_1" id_range_weight="" id_zone="Europe" price="5.000000"/>
|
||||
<delivery id="delivery_5" id_shop="" id_shop_group="" id_carrier="My_carrier" id_range_price="range_price_1" id_range_weight="" id_zone="North_America" price="5.000000"/>
|
||||
</entities>
|
||||
</entity_delivery>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<entity_orders>
|
||||
<fields primary="id_order" class="Order">
|
||||
<field name="reference"/>
|
||||
<field name="id_group_shop"/>
|
||||
<field name="id_shop_group"/>
|
||||
<field name="id_shop"/>
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_customer" relation="customer"/>
|
||||
@@ -41,7 +41,7 @@
|
||||
<field name="valid"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<orders id="orders_1" reference="XKBKNABJ" id_group_shop="1" id_shop="1" id_carrier="My_carrier" id_customer="John" id_cart="cart_1" id_currency="1" id_address_delivery="Mon_adresse" id_address_invoice="Mon_adresse" current_state="1" secure_key="47ce86627c1f3c792a80773c5d2deaf8" conversion_rate="1.000000" recyclable="0" gift="0" shipping_number="" total_discounts="0.00" total_discounts_tax_incl="0.00" total_paid="626.37" total_paid_tax_incl="626.37" total_paid_tax_excl="523.72" total_paid_real="626.37" total_products="516.72" total_products_wt="618.00" total_shipping="7.98" total_shipping_tax_incl="8.37" total_shipping_tax_excl="7.00" carrier_tax_rate="19.600" total_wrapping="0.00" total_wrapping_tax_incl="0.00" total_wrapping_tax_excl="0.00" invoice_number="0" delivery_number="0" invoice_date="0000-00-00 00:00:00" delivery_date="0000-00-00 00:00:00" valid="0">
|
||||
<orders id="orders_1" reference="XKBKNABJ" id_shop_group="1" id_shop="1" id_carrier="My_carrier" id_customer="John" id_cart="cart_1" id_currency="1" id_address_delivery="Mon_adresse" id_address_invoice="Mon_adresse" current_state="1" secure_key="47ce86627c1f3c792a80773c5d2deaf8" conversion_rate="1.000000" recyclable="0" gift="0" shipping_number="" total_discounts="0.00" total_discounts_tax_incl="0.00" total_paid="626.37" total_paid_tax_incl="626.37" total_paid_tax_excl="523.72" total_paid_real="626.37" total_products="516.72" total_products_wt="618.00" total_shipping="7.98" total_shipping_tax_incl="8.37" total_shipping_tax_excl="7.00" carrier_tax_rate="19.600" total_wrapping="0.00" total_wrapping_tax_incl="0.00" total_wrapping_tax_excl="0.00" invoice_number="0" delivery_number="0" invoice_date="0000-00-00 00:00:00" delivery_date="0000-00-00 00:00:00" valid="0">
|
||||
<payment>Chèque</payment>
|
||||
<module>cheque</module>
|
||||
<gift_message/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_product_attribute>
|
||||
<fields>
|
||||
<fields class="Combination">
|
||||
<field name="id_product" relation="product"/>
|
||||
<field name="reference"/>
|
||||
<field name="supplier_reference"/>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?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"/>
|
||||
<field name="id_shop"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_1_1_1" id_product="iPod_Nano" id_tax_rules_group="1" id_shop="1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_2_1_1" id_product="iPod_shuffle" id_tax_rules_group="1" id_shop="1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_3_1_1" id_product="MacBook_Air" id_tax_rules_group="1" id_shop="1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_4_1_1" id_product="MacBook" id_tax_rules_group="1" id_shop="1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_5_1_1" id_product="iPod_touch" id_tax_rules_group="1" id_shop="1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_6_1_1" id_product="Belkin_Leather_Folio_for_iPod_nano_-_Black_Chocolate" id_tax_rules_group="1" id_shop="1"/>
|
||||
<product_tax_rules_group_shop id="product_tax_rules_group_shop_7_1_1" id_product="Shure_SE210_Sound-Isolating_Earphones_for_iPod_and_iPhone" id_tax_rules_group="1" id_shop="1"/>
|
||||
</entities>
|
||||
</entity_product_tax_rules_group_shop>
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name="id_cart" relation="cart"/>
|
||||
<field name="id_product" relation="product"/>
|
||||
<field name="id_shop"/>
|
||||
<field name="id_group_shop"/>
|
||||
<field name="id_shop_group"/>
|
||||
<field name="id_currency"/>
|
||||
<field name="id_country" relation="country"/>
|
||||
<field name="id_group" relation="group"/>
|
||||
@@ -18,6 +18,6 @@
|
||||
<field name="to"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<specific_price id="specific_price_1" id_cart="" id_product="iPod_Nano" id_shop="0" id_group_shop="0" id_currency="0" id_country="" id_group="" id_customer="" id_product_attribute="" price="0.000000" from_quantity="1" reduction="0.050000" reduction_type="percentage" from="0000-00-00 00:00:00" to="0000-00-00 00:00:00"/>
|
||||
<specific_price id="specific_price_1" id_cart="" id_product="iPod_Nano" id_shop="0" id_shop_group="0" id_currency="0" id_country="" id_group="" id_customer="" id_product_attribute="" price="0.000000" from_quantity="1" reduction="0.050000" reduction_type="percentage" from="0000-00-00 00:00:00" to="0000-00-00 00:00:00"/>
|
||||
</entities>
|
||||
</entity_specific_price>
|
||||
|
||||
@@ -4,45 +4,45 @@
|
||||
<field name="id_product" relation="product"/>
|
||||
<field name="id_product_attribute" relation="product_attribute"/>
|
||||
<field name="id_shop"/>
|
||||
<field name="id_group_shop"/>
|
||||
<field name="id_shop_group"/>
|
||||
<field name="quantity"/>
|
||||
<field name="depends_on_stock"/>
|
||||
<field name="out_of_stock"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<stock_available id="stock_available_2" id_product="iPod_Nano" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="160" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_1" id_product="iPod_Nano" id_product_attribute="product_attribute_25" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_3" id_product="iPod_Nano" id_product_attribute="product_attribute_26" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_4" id_product="iPod_Nano" id_product_attribute="product_attribute_27" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_5" id_product="iPod_Nano" id_product_attribute="product_attribute_28" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_6" id_product="iPod_Nano" id_product_attribute="product_attribute_29" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_7" id_product="iPod_Nano" id_product_attribute="product_attribute_30" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_8" id_product="iPod_Nano" id_product_attribute="product_attribute_31" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_9" id_product="iPod_Nano" id_product_attribute="product_attribute_32" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_10" id_product="iPod_Nano" id_product_attribute="product_attribute_33" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_11" id_product="iPod_Nano" id_product_attribute="product_attribute_34" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_12" id_product="iPod_Nano" id_product_attribute="product_attribute_35" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_13" id_product="iPod_Nano" id_product_attribute="product_attribute_36" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_14" id_product="iPod_Nano" id_product_attribute="product_attribute_39" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_15" id_product="iPod_Nano" id_product_attribute="product_attribute_40" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_16" id_product="iPod_Nano" id_product_attribute="product_attribute_41" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_17" id_product="iPod_Nano" id_product_attribute="product_attribute_42" id_shop="1" id_group_shop="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_19" id_product="MacBook_Air" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="400" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_18" id_product="MacBook_Air" id_product_attribute="product_attribute_12" id_shop="1" id_group_shop="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_20" id_product="MacBook_Air" id_product_attribute="product_attribute_13" id_shop="1" id_group_shop="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_21" id_product="MacBook_Air" id_product_attribute="product_attribute_14" id_shop="1" id_group_shop="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_22" id_product="MacBook_Air" id_product_attribute="product_attribute_15" id_shop="1" id_group_shop="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_23" id_product="Belkin_Leather_Folio_for_iPod_nano_-_Black_Chocolate" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="25" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_25" id_product="iPod_shuffle" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="120" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_24" id_product="iPod_shuffle" id_product_attribute="product_attribute_7" id_shop="1" id_group_shop="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_26" id_product="iPod_shuffle" id_product_attribute="product_attribute_8" id_shop="1" id_group_shop="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_27" id_product="iPod_shuffle" id_product_attribute="product_attribute_9" id_shop="1" id_group_shop="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_28" id_product="iPod_shuffle" id_product_attribute="product_attribute_10" id_shop="1" id_group_shop="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_29" id_product="Shure_SE210_Sound-Isolating_Earphones_for_iPod_and_iPhone" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="15" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_30" id_product="MacBook" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="75" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_32" id_product="iPod_touch" id_product_attribute="" id_shop="1" id_group_shop="0" quantity="120" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_31" id_product="iPod_touch" id_product_attribute="product_attribute_19" id_shop="1" id_group_shop="0" quantity="40" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_33" id_product="iPod_touch" id_product_attribute="product_attribute_22" id_shop="1" id_group_shop="0" quantity="40" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_34" id_product="iPod_touch" id_product_attribute="product_attribute_23" id_shop="1" id_group_shop="0" quantity="40" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_2" id_product="iPod_Nano" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="160" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_1" id_product="iPod_Nano" id_product_attribute="product_attribute_25" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_3" id_product="iPod_Nano" id_product_attribute="product_attribute_26" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_4" id_product="iPod_Nano" id_product_attribute="product_attribute_27" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_5" id_product="iPod_Nano" id_product_attribute="product_attribute_28" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_6" id_product="iPod_Nano" id_product_attribute="product_attribute_29" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_7" id_product="iPod_Nano" id_product_attribute="product_attribute_30" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_8" id_product="iPod_Nano" id_product_attribute="product_attribute_31" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_9" id_product="iPod_Nano" id_product_attribute="product_attribute_32" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_10" id_product="iPod_Nano" id_product_attribute="product_attribute_33" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_11" id_product="iPod_Nano" id_product_attribute="product_attribute_34" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_12" id_product="iPod_Nano" id_product_attribute="product_attribute_35" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_13" id_product="iPod_Nano" id_product_attribute="product_attribute_36" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_14" id_product="iPod_Nano" id_product_attribute="product_attribute_39" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_15" id_product="iPod_Nano" id_product_attribute="product_attribute_40" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_16" id_product="iPod_Nano" id_product_attribute="product_attribute_41" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_17" id_product="iPod_Nano" id_product_attribute="product_attribute_42" id_shop="1" id_shop_group="0" quantity="10" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_19" id_product="MacBook_Air" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="400" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_18" id_product="MacBook_Air" id_product_attribute="product_attribute_12" id_shop="1" id_shop_group="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_20" id_product="MacBook_Air" id_product_attribute="product_attribute_13" id_shop="1" id_shop_group="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_21" id_product="MacBook_Air" id_product_attribute="product_attribute_14" id_shop="1" id_shop_group="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_22" id_product="MacBook_Air" id_product_attribute="product_attribute_15" id_shop="1" id_shop_group="0" quantity="100" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_23" id_product="Belkin_Leather_Folio_for_iPod_nano_-_Black_Chocolate" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="25" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_25" id_product="iPod_shuffle" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="120" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_24" id_product="iPod_shuffle" id_product_attribute="product_attribute_7" id_shop="1" id_shop_group="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_26" id_product="iPod_shuffle" id_product_attribute="product_attribute_8" id_shop="1" id_shop_group="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_27" id_product="iPod_shuffle" id_product_attribute="product_attribute_9" id_shop="1" id_shop_group="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_28" id_product="iPod_shuffle" id_product_attribute="product_attribute_10" id_shop="1" id_shop_group="0" quantity="30" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_29" id_product="Shure_SE210_Sound-Isolating_Earphones_for_iPod_and_iPhone" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="15" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_30" id_product="MacBook" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="75" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_32" id_product="iPod_touch" id_product_attribute="" id_shop="1" id_shop_group="0" quantity="120" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_31" id_product="iPod_touch" id_product_attribute="product_attribute_19" id_shop="1" id_shop_group="0" quantity="40" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_33" id_product="iPod_touch" id_product_attribute="product_attribute_22" id_shop="1" id_shop_group="0" quantity="40" depends_on_stock="0" out_of_stock="0"/>
|
||||
<stock_available id="stock_available_34" id_product="iPod_touch" id_product_attribute="product_attribute_23" id_shop="1" id_shop_group="0" quantity="40" depends_on_stock="0" out_of_stock="0"/>
|
||||
</entities>
|
||||
</entity_stock_available>
|
||||
|
||||
@@ -223,10 +223,10 @@ class InstallModelInstall extends InstallAbstractModel
|
||||
public function createShop($shop_name)
|
||||
{
|
||||
// Create default group shop
|
||||
$group_shop = new GroupShop();
|
||||
$group_shop->name = 'Default';
|
||||
$group_shop->active = true;
|
||||
if (!$group_shop->add())
|
||||
$shop_group = new ShopGroup();
|
||||
$shop_group->name = 'Default';
|
||||
$shop_group->active = true;
|
||||
if (!$shop_group->add())
|
||||
{
|
||||
$this->setError($this->language->l('Cannot create group shop'));
|
||||
return false;
|
||||
@@ -235,7 +235,7 @@ class InstallModelInstall extends InstallAbstractModel
|
||||
// Create default shop
|
||||
$shop = new Shop();
|
||||
$shop->active = true;
|
||||
$shop->id_group_shop = $group_shop->id;
|
||||
$shop->id_shop_group = $shop_group->id;
|
||||
$shop->id_category = 2;
|
||||
$shop->id_theme = 1;
|
||||
$shop->name = $shop_name;
|
||||
|
||||
@@ -54,17 +54,17 @@ function create_multistore()
|
||||
VALUES(1, \''.pSQL($shop_domain).'\', \''.pSQL($shop_domain_ssl).'\', \''.pSQL($_PS_DIRECTORY_).'\', \'\', 1, 1)');
|
||||
|
||||
// Stock conversion
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`)
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_shop_group`, `id_shop`, `quantity`)
|
||||
VALUES (SELECT `p.id_product`, 0, 1, 1, `p.quantity` FROM `'._DB_PREFIX_.'.product` p);';
|
||||
$res &= Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`)
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_shop_group`, `id_shop`, `quantity`)
|
||||
VALUES (SELECT `id_product`, `id_product_attribute`, 1, 1, `quantity` FROM `'._DB_PREFIX_.'product_attribute` p);';
|
||||
$res &= Db::getInstance()->execute($sql);
|
||||
|
||||
// Add admin tabs
|
||||
$shopTabId = add_new_tab('AdminShop', 'it:Shops|es:Shops|fr:Boutiques|de:Shops|en:Shops', 0, true);
|
||||
add_new_tab('AdminGroupShop', 'it:Group Shops|es:Group Shops|fr:Groupes de boutique|de:Group Shops|en:Group Shops', $shopTabId);
|
||||
add_new_tab('AdminShopGroup', 'it:Group Shops|es:Group Shops|fr:Groupes de boutique|de:Group Shops|en:Group Shops', $shopTabId);
|
||||
add_new_tab('AdminShopUrl', 'it:Shop Urls|es:Shop Urls|fr:URLs de boutique|de:Shop Urls|en:Shop Urls', $shopTabId);
|
||||
|
||||
return $res;
|
||||
|
||||
@@ -32,7 +32,7 @@ function module_blockwishlist_multishop()
|
||||
{
|
||||
$res = Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'wishlist`
|
||||
ADD `id_shop` INTEGER NOT NULL default \'1\' AFTER `counter`,
|
||||
ADD `id_group_shop` INTEGER NOT NULL default \'1\' AFTER `id_shop`');
|
||||
ADD `id_shop_group` INTEGER NOT NULL default \'1\' AFTER `id_shop`');
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ function set_stock_available()
|
||||
//add stock available for attributes
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'stock_available`
|
||||
(`id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`)
|
||||
(`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`, `quantity`, `depends_on_stock`, `out_of_stock`)
|
||||
VALUES
|
||||
("'.(int)$row['id_product'].'", "'.(int)$attribute['id_product_attribute'].'", "1", "0", "'.(int)$attribute['quantity'].'", "0", "'.(int)$row['out_of_stock'].'")
|
||||
');
|
||||
@@ -43,7 +43,7 @@ function set_stock_available()
|
||||
//Add stock available for product
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'stock_available`
|
||||
(`id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`)
|
||||
(`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`, `quantity`, `depends_on_stock`, `out_of_stock`)
|
||||
VALUES
|
||||
("'.(int)$row['id_product'].'", "0", "1", "0", "'.(int)$quantity.'", "0", "'.(int)$row['out_of_stock'].'")
|
||||
');
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
SET NAMES 'utf8';
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_group_shop` (
|
||||
`id_group_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_shop_group` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`share_customer` TINYINT(1) NOT NULL,
|
||||
`share_order` TINYINT(1) NOT NULL,
|
||||
`share_stock` TINYINT(1) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_group_shop`)
|
||||
PRIMARY KEY (`id_shop_group`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_group_shop` (`id_group_shop`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0);
|
||||
INSERT INTO `PREFIX_group_shop` (`id_shop_group`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_shop` (
|
||||
`id_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_group_shop` int(11) unsigned NOT NULL,
|
||||
`id_shop_group` int(11) unsigned NOT NULL,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`id_category` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_theme` INT(1) UNSIGNED NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_category` (`id_category`),
|
||||
KEY `id_theme` (`id_theme`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_shop`
|
||||
(`id_shop`, `id_group_shop`, `name`, `id_category`, `id_theme`, `active`, `deleted`)
|
||||
(`id_shop`, `id_shop_group`, `name`, `id_category`, `id_theme`, `active`, `deleted`)
|
||||
VALUES
|
||||
(1, 1, (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_SHOP_NAME'), 1, 1, 1, 0);
|
||||
|
||||
ALTER TABLE `PREFIX_configuration` ADD `id_group_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_group_shop`;
|
||||
ALTER TABLE `PREFIX_configuration` ADD `id_shop_group` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_shop_group`;
|
||||
ALTER TABLE `PREFIX_configuration` DROP INDEX `name` , ADD INDEX `name` ( `name` ) ;
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_group_shop`);
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop_group`);
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop`);
|
||||
INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, 'PS_SHOP_DEFAULT', '1', NOW(), NOW());
|
||||
|
||||
@@ -123,9 +123,9 @@ CREATE TABLE `PREFIX_currency_shop` (
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_currency_shop` (id_shop, id_currency) (SELECT 1, id_currency FROM PREFIX_currency);
|
||||
|
||||
ALTER TABLE `PREFIX_cart` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
ALTER TABLE `PREFIX_cart` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_shop_group`, ADD INDEX `id_shop_group` (`id_shop_group`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
ALTER TABLE `PREFIX_customer` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
ALTER TABLE `PREFIX_customer` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_shop_group`, ADD INDEX `id_shop_group` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
ALTER TABLE `PREFIX_orders` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_order` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
|
||||
@@ -2,4 +2,141 @@
|
||||
|
||||
ALTER TABLE `PREFIX_supplier` DROP `id_address`;
|
||||
|
||||
UPDATE `PREFIX_meta` SET `page` = 'contact' WHERE `page` = 'contact-form';
|
||||
UPDATE `PREFIX_meta` SET `page` = 'contact' WHERE `page` = 'contact-form';
|
||||
|
||||
RENAME TABLE `PREFIX_group_shop` TO `PREFIX_shop_group`;
|
||||
ALTER TABLE `PREFIX_shop_group` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `PREFIX_shop` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_stock_available` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_cart` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_configuration` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_connections` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_customer` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_delivery` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_orders` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_page_viewed` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_specific_price` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_product` ADD `id_tax_rules_group` int(10) unsigned NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_product_shop_TMP` (
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`id_category_default` int(10) unsigned DEFAULT NULL,
|
||||
`id_tax_rules_group` INT(11) UNSIGNED NOT NULL,
|
||||
`on_sale` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`online_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
|
||||
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`unity` varchar(255) DEFAULT NULL,
|
||||
`unit_price_ratio` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`additional_shipping_cost` decimal(20,2) NOT NULL DEFAULT '0.00',
|
||||
`customizable` tinyint(2) NOT NULL DEFAULT '0',
|
||||
`text_fields` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`available_for_order` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`available_date` date NOT NULL,
|
||||
`condition` enum('new','used','refurbished') NOT NULL DEFAULT 'new',
|
||||
`show_price` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`indexed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`visibility` enum('both','catalog','search','none') NOT NULL DEFAULT 'both',
|
||||
`cache_default_attribute` int(10) unsigned DEFAULT NULL,
|
||||
`advanced_stock_management` tinyint(1) default '0' NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_product`, `id_shop`),
|
||||
KEY `id_category_default` (`id_category_default`),
|
||||
KEY `date_add` (`date_add`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_product_shop_TMP` (`id_product`, `id_shop`, `id_category_default`, `on_sale`, `online_only`, `ecotax`, `minimal_quantity`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `customizable`, `text_fields`, `active`, `available_for_order`, `available_date`, `condition`, `show_price`, `indexed`, `visibility`, `cache_default_attribute`, `advanced_stock_management`, `date_add`, `date_upd`, `id_tax_rules_group`)
|
||||
(SELECT a.`id_product`, a.`id_shop`, b.`id_category_default`, b.`on_sale`, b.`online_only`, b.`ecotax`, b.`minimal_quantity`, b.`price`, b.`wholesale_price`, b.`unity`, b.`unit_price_ratio`, b.`additional_shipping_cost`, b.`customizable`, b.`text_fields`, b.`active`, b.`available_for_order`, b.`available_date`, b.`condition`, b.`show_price`, b.`indexed`, b.`visibility`, b.`cache_default_attribute`, b.`advanced_stock_management`, b.`date_add`, b.`date_upd`, c.`id_tax_rules_group` FROM `PREFIX_product_shop` a INNER JOIN `PREFIX_product` b ON a.id_product = b.id_product LEFT JOIN `PREFIX_product_tax_rules_group_shop` c ON b.id_product = c.id_product AND a.id_shop = c.id_shop);
|
||||
DROP TABLE `PREFIX_product_shop`;
|
||||
DROP TABLE `PREFIX_product_tax_rules_group_shop`;
|
||||
RENAME TABLE `PREFIX_product_shop_TMP` TO `PREFIX_product_shop`;
|
||||
|
||||
CREATE TABLE `PREFIX_product_attribute_shop` (
|
||||
`id_product_attribute` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`wholesale_price` decimal(20,6) NOT NULL default '0.000000',
|
||||
`price` decimal(20,6) NOT NULL default '0.000000',
|
||||
`ecotax` decimal(17,6) NOT NULL default '0.00',
|
||||
`unit_price_impact` decimal(17,2) NOT NULL default '0.00',
|
||||
`default_on` tinyint(1) unsigned NOT NULL default '0',
|
||||
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`available_date` date NOT NULL,
|
||||
PRIMARY KEY (`id_product_attribute`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_product_attribute_shop` (`id_product_attribute`, `id_shop`, `wholesale_price`, `price`, `ecotax`, `unit_price_impact`, `default_on`, `minimal_quantity`, `available_date`) (SELECT `id_product_attribute`, (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_SHOP_DEFAULT'), `wholesale_price`, `price`, `ecotax`, `unit_price_impact`, `default_on`, `minimal_quantity`, `available_date` FROM `PREFIX_product_attribute`);
|
||||
|
||||
INSERT INTO `PREFIX_attribute_shop` (`id_attribute`, `id_shop`) (SELECT a.id_attribute, c.id_shop FROM PREFIX_attribute_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_attribute_shop` (
|
||||
`id_attribute` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_attribute`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_attribute_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_feature_shop` (`id_feature`, `id_shop`) (SELECT a.id_feature, c.id_shop FROM PREFIX_feature_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_feature_shop` (
|
||||
`id_feature` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_feature`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_feature_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_group_shop` (`id_group`, `id_shop`) (SELECT a.id_group, c.id_shop FROM PREFIX_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_group_shop` (
|
||||
`id_group` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_group_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_attribute_group_shop` (`id_attribute_group`, `id_shop`) (SELECT a.id_attribute_group, c.id_shop FROM PREFIX_attribute_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_attribute_group_shop` (
|
||||
`id_attribute_group` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_attribute_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_attribute_group_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_tax_rules_group_shop` (`id_tax_rules_group`, `id_shop`) (SELECT a.id_tax_rules_group, c.id_shop FROM PREFIX_tax_rules_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_tax_rules_group_shop` (
|
||||
`id_tax_rules_group` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_tax_rules_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_tax_rules_group_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_zone_shop` (`id_zone`, `id_shop`) (SELECT a.id_zone, c.id_shop FROM PREFIX_zone_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_zone_shop` (
|
||||
`id_zone` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_zone`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_zone_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_manufacturer_shop` (`id_manufacturer`, `id_shop`) (SELECT a.id_manufacturer, c.id_shop FROM PREFIX_manufacturer_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_manufacturer_shop` (
|
||||
`id_manufacturer` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_manufacturer`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_manufacturer_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_supplier_shop` (`id_supplier`, `id_shop`) (SELECT a.id_supplier, c.id_shop FROM PREFIX_supplier_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_supplier_shop` (
|
||||
`id_supplier` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_supplier`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_supplier_group_shop`;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user