// BugFix

This commit is contained in:
mDeflotte committed 2011-12-15 10:50:42 +00:00
1 parent 4f92b82a6e
commit 1a5a08cefb
6 files changed
+19 -96

No files matched your search

-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;
*/
} }
} }
+1 -1
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); });
} }
+12
View File
@@ -1188,6 +1188,8 @@ 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();
if (isset($_POST['checkBoxShopAsso_layered_filter']))
{
foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_asso_object => $row) foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_asso_object => $row)
{ {
foreach ($row as $id_shop => $value) foreach ($row as $id_shop => $value)
@@ -1199,6 +1201,9 @@ class BlockLayered extends Module
} }
else else
$shop_list = array(0); $shop_list = array(0);
}
else
$shop_list = array(0);
if (count($_POST['categoryBox'])) if (count($_POST['categoryBox']))
{ {
@@ -1278,6 +1283,7 @@ class BlockLayered extends Module
{ {
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);
if (isset($assos))
foreach ($assos as $asso) foreach ($assos as $asso)
Db::getInstance()->execute('INSERT INTO layered_filter_shop (`id_layered_filter`, `id_shop`) Db::getInstance()->execute('INSERT INTO layered_filter_shop (`id_layered_filter`, `id_shop`)
VALUES('.$id_layered_filter.', '.(int)$asso['id_shop'].')'); VALUES('.$id_layered_filter.', '.(int)$asso['id_shop'].')');
@@ -1586,9 +1592,12 @@ class BlockLayered extends Module
$helper->table = 'layered_filter'; $helper->table = 'layered_filter';
$helper->identifier = 'id_layered_filter'; $helper->identifier = 'id_layered_filter';
if (Shop::isFeatureActive())
{
$html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >'.$this->l('Choose shop association:').'</span>'; $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 .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">'.$helper->renderAssoShop().'</div>';
} }
}
$html .= ' $html .= '
<div id="error-treeview" class="error" style="display: none;"> <div id="error-treeview" class="error" style="display: none;">
@@ -3274,6 +3283,8 @@ 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))
{
if (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_ALL)
{ {
$helper = new Helper(); $helper = new Helper();
$helper->id = (int)$id_layered_filter; $helper->id = (int)$id_layered_filter;
@@ -3295,6 +3306,7 @@ class BlockLayered extends Module
}); });
</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>