// id_shop on cart product (for links) + change Shop::sqlAsso() + share_order
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7687 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -605,14 +605,17 @@ class AdminCustomers extends AdminTab
|
||||
echo $this->l('No cart available').'.';
|
||||
echo '</div>';
|
||||
|
||||
$interested = Db::getInstance()->ExecuteS('SELECT DISTINCT id_product, c.id_cart, c.id_shop
|
||||
FROM '._DB_PREFIX_.'cart_product cp
|
||||
JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart)
|
||||
WHERE c.id_customer = '.(int)$customer->id.'
|
||||
AND cp.id_product NOT IN (SELECT product_id
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order)
|
||||
WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.')');
|
||||
$sql = 'SELECT DISTINCT id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
|
||||
FROM '._DB_PREFIX_.'cart_product cp
|
||||
JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart)
|
||||
WHERE c.id_customer = '.(int)$customer->id.'
|
||||
AND cp.id_product NOT IN (
|
||||
SELECT product_id
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order)
|
||||
WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.'
|
||||
)';
|
||||
$interested = Db::getInstance()->ExecuteS($sql);
|
||||
if (count($interested))
|
||||
{
|
||||
echo '<div style="float:left;margin-left:20px">
|
||||
@@ -621,11 +624,12 @@ class AdminCustomers extends AdminTab
|
||||
foreach ($interested as $p)
|
||||
{
|
||||
$product = new Product($p['id_product'], false, $context->language->id, $p['id_shop']);
|
||||
$url = $context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $context->language->id), null, null, $p['cp_id_shop']);
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \''.$context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $context->language->id)).'\'">
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \''.$url.'\'">
|
||||
<td>'.(int)$product->id.'</td>
|
||||
<td>'.Tools::htmlentitiesUTF8($product->name).'</td>
|
||||
<td align="center"><a href="'.$context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $context->language->id)).'"><img src="../img/admin/details.gif" /></a></td>
|
||||
<td align="center"><a href="'.$url.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '</table></div>';
|
||||
|
||||
@@ -71,6 +71,25 @@ class AdminGroupShop extends AdminTab
|
||||
$disabled = 'disabled="disabled"';
|
||||
else
|
||||
$disabled = '';
|
||||
|
||||
echo <<<EOF
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$().ready(function()
|
||||
{
|
||||
$('input[name=share_order]').attr('disabled', true);
|
||||
$('input[name=share_customer], input[name=share_stock]').click(function()
|
||||
{
|
||||
var disabled = ($('input[name=share_customer]').attr('checked') && $('input[name=share_stock]').attr('checked')) ? false : true;
|
||||
$('input[name=share_order]').attr('disabled', disabled);
|
||||
if (disabled)
|
||||
$('#share_order_off').attr('checked', true);
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
EOF;
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
@@ -79,22 +98,30 @@ class AdminGroupShop extends AdminTab
|
||||
<div class="margin-form">
|
||||
<input type="text" name="name" id="name" value="'.$this->getFieldValue($obj, 'name').'" />
|
||||
</div>
|
||||
<label for="share_datas">'.$this->l('Share datas').'</label>
|
||||
<label for="share_customer">'.$this->l('Share customers').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="share_datas" '.$disabled.' id="share_datas_on" value="1" '.($this->getFieldValue($obj, 'share_datas') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_datas_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="share_datas" '.$disabled.' id="share_datas_off" value="0" '.(!$this->getFieldValue($obj, 'share_datas') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Share customers, orders and carts between shops of this group').'</p>
|
||||
<input type="radio" name="share_customer" '.$disabled.' id="share_customer_on" value="1" '.($this->getFieldValue($obj, 'share_customer') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_customer_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="share_customer" '.$disabled.' id="share_customer_off" value="0" '.(!$this->getFieldValue($obj, 'share_customer') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="ashare_customer_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Share customers between shops of this group').'</p>
|
||||
</div>
|
||||
<label for="share_stock">'.$this->l('Share stock').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="share_stock" '.$disabled.' id="share_stock_on" value="1" '.($this->getFieldValue($obj, 'share_stock') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_stock_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="share_stock" '.$disabled.' id="share_datas_off" value="0" '.(!$this->getFieldValue($obj, 'share_stock') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<input type="radio" name="share_stock" '.$disabled.' id="share_stock_off" value="0" '.(!$this->getFieldValue($obj, 'share_stock') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_stock_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Sare stock between shops of this group').'</p>
|
||||
</div>
|
||||
<label for="share_order">'.$this->l('Share orders').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="share_order" '.$disabled.' id="share_order_on" value="1" '.($this->getFieldValue($obj, 'share_order') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_order_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="share_order" '.$disabled.' id="share_order_off" value="0" '.(!$this->getFieldValue($obj, 'share_order') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_order_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Share orders and carts between shops of this group (you can share orders only if you share customers and stock)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
|
||||
@@ -66,7 +66,7 @@ class AdminProducts extends AdminTab
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
|
||||
$this->_filter = 'AND cp.`id_category` = '.(int)($this->_category->id);
|
||||
$this->_select = 'cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final, SUM(stock.quantity) AS quantity';
|
||||
$this->_group = 'GROUP BY stock.id_product';
|
||||
$this->_group = 'GROUP BY a.id_product';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user