// BugFix

This commit is contained in:
mDeflotte
2011-12-15 10:50:42 +00:00
parent 4f92b82a6e
commit 1a5a08cefb
6 changed files with 48 additions and 125 deletions
-91
View File
@@ -345,97 +345,6 @@ class HelperCore
'table' => $this->table 'table' => $this->table
)); ));
return $tpl->fetch(); return $tpl->fetch();
/*
//$page = $this->context->smarty->fetch($tpl);
$html = <<<EOF
<script type="text/javascript">
$().ready(function()
{
// Click on "all shop"
$('.input_all_shop').click(function()
{
var checked = $(this).attr('checked');
$('.input_group_shop').attr('checked', checked);
$('.input_shop').attr('checked', checked);
});
// Click on a group shop
$('.input_group_shop').click(function()
{
$('.input_shop[value='+$(this).val()+']').attr('checked', $(this).attr('checked'));
check_all_shop();
});
// Click on a shop
$('.input_shop').click(function()
{
check_group_shop_status($(this).val());
check_all_shop();
});
// Initialize checkbox
$('.input_shop').each(function(k, v)
{
check_group_shop_status($(v).val());
check_all_shop();
});
});
function check_group_shop_status(id_group)
{
var groupChecked = true;
$('.input_shop[value='+id_group+']').each(function(k, v)
{
if (!$(v).attr('checked'))
groupChecked = false;
});
$('.input_group_shop[value='+id_group+']').attr('checked', groupChecked);
}
function check_all_shop()
{
var allChecked = true;
$('.input_group_shop').each(function(k, v)
{
if (!$(v).attr('checked'))
allChecked = false;
});
$('.input_all_shop').attr('checked', allChecked);
}
</script>
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>';
foreach (Shop::getTree() as $groupID => $groupData)
{
$groupChecked = ($type == 'group_shop' && ((isset($assos[$groupID]) && in_array($this->id, $assos[$groupID])) || !$this->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->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)
{
$checked = ((isset($assos[$shopID]) && in_array($this->id, $assos[$shopID])) || !$this->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->id.'_'.$shopID.'" id="checkedBox_'.$shopID.'" '.($checked ? 'checked="checked"' : '').' /> ';
$html .= $shopData['name'].'</label></td>';
$html .= '</tr>';
$j++;
}
}
}
$html .= '</table></div>';
return $html;
*/
} }
} }
+2 -2
View File
@@ -86,12 +86,12 @@ class CategoryControllerCore extends FrontController
if (isset($this->context->cookie->id_compare)) if (isset($this->context->cookie->id_compare))
$this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare));
$this->productSort(); // Product sort must be called before assignProductList()
$this->assignScenes(); $this->assignScenes();
if ($this->category->id != 1) if ($this->category->id != 1)
$this->assignProductList(); $this->assignProductList();
$this->productSort();
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'category' => $this->category, 'category' => $this->category,
'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : NULL, 'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : NULL,
+2 -1
View File
@@ -24,7 +24,8 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
include(dirname(__FILE__).'/blockcart.php'); // @TODO Find the reason why the blockcart.php is includ multiple time
include_once(dirname(__FILE__).'/blockcart.php');
$context = Context::getContext(); $context = Context::getContext();
$blockCart = new BlockCart(); $blockCart = new BlockCart();
echo $blockCart->hookAjaxCall(array('cookie' => $context->cookie, 'cart' => $context->cart)); echo $blockCart->hookAjaxCall(array('cookie' => $context->cookie, 'cart' => $context->cart));
+3 -3
View File
@@ -422,7 +422,7 @@ function getUrlParams()
function updateProductUrl() function updateProductUrl()
{ {
// Adding the filters to URL product // Adding the filters to URL product
$('ul#product_list li.ajax_block_product .product_img_link').attr('href', $('ul#product_list li.ajax_block_product .product_img_link').attr('href') + param_product_url); $.each($('ul#product_list li.ajax_block_product .product_img_link, ul#product_list li.ajax_block_product h3 a, ul#product_list li.ajax_block_product .product_desc a'), function() {
$('ul#product_list li.ajax_block_product h3 a').attr('href', $('ul#product_list li.ajax_block_product h3 a').attr('href') + param_product_url); $(this).attr('href', $(this).attr('href') + param_product_url);
$('ul#product_list li.ajax_block_product .product_desc a').attr('href', $('ul#product_list li.ajax_block_product .product_desc a').attr('href') + param_product_url); });
} }
+40 -28
View File
@@ -1188,14 +1188,19 @@ class BlockLayered extends Module
$id_layered_filter = (int)Db::getInstance()->Insert_ID(); $id_layered_filter = (int)Db::getInstance()->Insert_ID();
$shop_list = array(); $shop_list = array();
foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_asso_object => $row) if (isset($_POST['checkBoxShopAsso_layered_filter']))
{ {
foreach ($row as $id_shop => $value) foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_asso_object => $row)
{ {
$assos[] = array('id_object' => (int)$id_layered_filter, 'id_shop' => (int)$id_shop); foreach ($row as $id_shop => $value)
$shop_list[] = (int)$id_shop; {
$assos[] = array('id_object' => (int)$id_layered_filter, 'id_shop' => (int)$id_shop);
$shop_list[] = (int)$id_shop;
}
} }
} }
else
$shop_list = array(0);
} }
else else
$shop_list = array(0); $shop_list = array(0);
@@ -1277,10 +1282,11 @@ class BlockLayered extends Module
if (version_compare(_PS_VERSION_,'1.5','>')) if (version_compare(_PS_VERSION_,'1.5','>'))
{ {
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter_shop WHERE `id_layered_filter` = '.(int)$id_layered_filter); Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter_shop WHERE `id_layered_filter` = '.(int)$id_layered_filter);
foreach ($assos as $asso) if (isset($assos))
Db::getInstance()->execute('INSERT INTO layered_filter_shop (`id_layered_filter`, `id_shop`) foreach ($assos as $asso)
VALUES('.$id_layered_filter.', '.(int)$asso['id_shop'].')'); Db::getInstance()->execute('INSERT INTO layered_filter_shop (`id_layered_filter`, `id_shop`)
VALUES('.$id_layered_filter.', '.(int)$asso['id_shop'].')');
} }
$html .= '<div class="conf">'.(version_compare(_PS_VERSION_,'1.5','>') ? '' : '<img src="../img/admin/ok2.png" alt="" />'). $html .= '<div class="conf">'.(version_compare(_PS_VERSION_,'1.5','>') ? '' : '<img src="../img/admin/ok2.png" alt="" />').
@@ -1586,8 +1592,11 @@ class BlockLayered extends Module
$helper->table = 'layered_filter'; $helper->table = 'layered_filter';
$helper->identifier = 'id_layered_filter'; $helper->identifier = 'id_layered_filter';
$html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >'.$this->l('Choose shop association:').'</span>'; if (Shop::isFeatureActive())
$html .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">'.$helper->renderAssoShop().'</div>'; {
$html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >'.$this->l('Choose shop association:').'</span>';
$html .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">'.$helper->renderAssoShop().'</div>';
}
} }
$html .= ' $html .= '
@@ -3275,25 +3284,28 @@ class BlockLayered extends Module
if (version_compare(_PS_VERSION_,'1.5','>') && !empty($id_layered_filter)) if (version_compare(_PS_VERSION_,'1.5','>') && !empty($id_layered_filter))
{ {
$helper = new Helper(); if (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_ALL)
$helper->id = (int)$id_layered_filter; {
$helper->table = 'layered_filter'; $helper = new Helper();
$helper->identifier = 'id_layered_filter'; $helper->id = (int)$id_layered_filter;
$helper->base_folder = Tools::getValue('base_folder').'/themes/template/'; $helper->table = 'layered_filter';
$helper->identifier = 'id_layered_filter';
$html .= ' $helper->base_folder = Tools::getValue('base_folder').'/themes/template/';
<div id="shop_association_ajax">'.$helper->renderAssoShop().'</div>
<script type="text/javascript"> $html .= '
$(document).ready(function() { <div id="shop_association_ajax">'.$helper->renderAssoShop().'</div>
$(\'#shop_association\').html($(\'#shop_association_ajax\').html()); <script type="text/javascript">
$(\'#shop_association_ajax\').remove(); $(document).ready(function() {
// Initialize checkbox $(\'#shop_association\').html($(\'#shop_association_ajax\').html());
$(\'.input_shop\').each(function(k, v) { $(\'#shop_association_ajax\').remove();
check_group_shop_status($(v).val()); // Initialize checkbox
check_all_shop(); $(\'.input_shop\').each(function(k, v) {
check_group_shop_status($(v).val());
check_all_shop();
});
}); });
}); </script>';
</script>'; }
} }
return $html; return $html;
+1
View File
@@ -56,6 +56,7 @@ $(document).ready(function()
<p class="select"> <p class="select">
<label for="selectPrductSort">{l s='Sort by'}</label> <label for="selectPrductSort">{l s='Sort by'}</label>
<select id="selectPrductSort"> <select id="selectPrductSort">
<option value="{$orderbydefault|escape:'htmlall':'UTF-8'}:{$orderwaydefault|escape:'htmlall':'UTF-8'}" {if $orderby eq $orderbydefault}selected="selected"{/if}>{l s='--'}</option>
{if !$PS_CATALOG_MODE} {if !$PS_CATALOG_MODE}
<option value="price:asc" {if $orderby eq 'price' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Price: lowest first'}</option> <option value="price:asc" {if $orderby eq 'price' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Price: lowest first'}</option>
<option value="price:desc" {if $orderby eq 'price' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Price: highest first'}</option> <option value="price:desc" {if $orderby eq 'price' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Price: highest first'}</option>