// Add multishop for the Blockwishlist
This commit is contained in:
@@ -26,71 +26,71 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$iso}" lang="{$iso}">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
||||
<meta name="robots" content="NOFOLLOW, NOINDEX" />
|
||||
<title>{$meta_title} - PrestaShop™</title>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
||||
<meta name="robots" content="NOFOLLOW, NOINDEX" />
|
||||
<title>{$meta_title} - PrestaShop™</title>
|
||||
{if $display_header}
|
||||
<script type="text/javascript">
|
||||
var help_class_name = '{$controller_name}';
|
||||
var iso_user = '{$iso_user}';
|
||||
var country_iso_code = '{$country_iso_code}';
|
||||
var _PS_VERSION_ = '{$smarty.const._PS_VERSION_}';
|
||||
<script type="text/javascript">
|
||||
var help_class_name = '{$controller_name}';
|
||||
var iso_user = '{$iso_user}';
|
||||
var country_iso_code = '{$country_iso_code}';
|
||||
var _PS_VERSION_ = '{$smarty.const._PS_VERSION_}';
|
||||
|
||||
var helpboxes = {$help_box};
|
||||
var roundMode = {$round_mode};
|
||||
{if isset($shop_context)}
|
||||
{if $shop_context == Shop::CONTEXT_ALL}
|
||||
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops' slashes=1 }";
|
||||
{elseif $shop_context == Shop::CONTEXT_GROUP}
|
||||
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops of group ' slashes=1 }<b>{$shop_name}</b>";
|
||||
{else}
|
||||
var youEditFieldFor = "{l s='A modification of this field will be applied for the shop ' slashes=1 }<b>{$shop_name}</b>";
|
||||
{/if}
|
||||
{else}
|
||||
var youEditFieldFor = '';
|
||||
{/if}
|
||||
{* Notifications vars *}
|
||||
var autorefresh_notifications = '{$autorefresh_notifications}';
|
||||
var new_order_msg = '{l s='A new order has been made on your shop.' slashes=1 }';
|
||||
var order_number_msg = '{l s='Order number : ' slashes=1 }';
|
||||
var total_msg = '{l s='Total : ' slashes=1 }';
|
||||
var from_msg = '{l s='From : ' slashes=1 }';
|
||||
var see_order_msg = '{l s='Click here to see that order' slashes=1 }';
|
||||
var new_customer_msg = '{l s='A new customer registered on your shop.' slashes=1}';
|
||||
var customer_name_msg = '{l s='Customer name : ' slashes=1 }';
|
||||
var see_customer_msg = '{l s='Click here to see that customer' slashes=1 }';
|
||||
var new_msg = '{l s='A new message posted on your shop.' slashes=1 }';
|
||||
var excerpt_msg = '{l s='Excerpt : ' slashes=1 }';
|
||||
var see_msg = '{l s='Click here to see that message' slashes=1 }';
|
||||
var token_admin_orders = '{getAdminToken tab='AdminOrders' slashes=1 }';
|
||||
var token_admin_customers = '{getAdminToken tab='AdminCustomers' slashes=1 }';
|
||||
var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads' slashes=1 }';
|
||||
</script>
|
||||
var helpboxes = {$help_box};
|
||||
var roundMode = {$round_mode};
|
||||
{if isset($shop_context)}
|
||||
{if $shop_context == Shop::CONTEXT_ALL}
|
||||
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops' slashes=1 }";
|
||||
{elseif $shop_context == Shop::CONTEXT_GROUP}
|
||||
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops of group ' slashes=1 }<b>{$shop_name}</b>";
|
||||
{else}
|
||||
var youEditFieldFor = "{l s='A modification of this field will be applied for the shop ' slashes=1 }<b>{$shop_name}</b>";
|
||||
{/if}
|
||||
{else}
|
||||
var youEditFieldFor = '';
|
||||
{/if}
|
||||
{* Notifications vars *}
|
||||
var autorefresh_notifications = '{$autorefresh_notifications}';
|
||||
var new_order_msg = '{l s='A new order has been made on your shop.' slashes=1 }';
|
||||
var order_number_msg = '{l s='Order number : ' slashes=1 }';
|
||||
var total_msg = '{l s='Total : ' slashes=1 }';
|
||||
var from_msg = '{l s='From : ' slashes=1 }';
|
||||
var see_order_msg = '{l s='Click here to see that order' slashes=1 }';
|
||||
var new_customer_msg = '{l s='A new customer registered on your shop.' slashes=1}';
|
||||
var customer_name_msg = '{l s='Customer name : ' slashes=1 }';
|
||||
var see_customer_msg = '{l s='Click here to see that customer' slashes=1 }';
|
||||
var new_msg = '{l s='A new message posted on your shop.' slashes=1 }';
|
||||
var excerpt_msg = '{l s='Excerpt : ' slashes=1 }';
|
||||
var see_msg = '{l s='Click here to see that message' slashes=1 }';
|
||||
var token_admin_orders = '{getAdminToken tab='AdminOrders' slashes=1 }';
|
||||
var token_admin_customers = '{getAdminToken tab='AdminCustomers' slashes=1 }';
|
||||
var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads' slashes=1 }';
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
{if isset($css_files)}
|
||||
{foreach from=$css_files key=css_uri item=media}
|
||||
<link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
|
||||
{/foreach}
|
||||
{foreach from=$css_files key=css_uri item=media}
|
||||
<link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
|
||||
{/foreach}
|
||||
{/if}
|
||||
{if isset($js_files)}
|
||||
{foreach from=$js_files item=js_uri}
|
||||
<script type="text/javascript" src="{$js_uri}"></script>
|
||||
{/foreach}
|
||||
{foreach from=$js_files item=js_uri}
|
||||
<script type="text/javascript" src="{$js_uri}"></script>
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
<link rel="shortcut icon" href="{$img_dir}favicon.ico" />
|
||||
<link rel="shortcut icon" href="{$img_dir}favicon.ico" />
|
||||
{if $display_header}
|
||||
{hook h="displayBackOfficeHeader"}
|
||||
{hook h="displayBackOfficeHeader"}
|
||||
{/if}
|
||||
<!--[if IE]>
|
||||
<link type="text/css" rel="stylesheet" href="{$base_url}css/admin-ie.css" />
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {
|
||||
color:{$brightness}
|
||||
}
|
||||
</style>
|
||||
<!--[if IE]>
|
||||
<link type="text/css" rel="stylesheet" href="{$base_url}css/admin-ie.css" />
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {
|
||||
color:{$brightness}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="{if $bo_color}background:{$bo_color};{/if}{if $bo_width > 0}text-align:center;{/if}">
|
||||
{if $display_header}
|
||||
@@ -99,131 +99,131 @@
|
||||
<div id="top_container" {if $bo_width > 0}style="margin:auto;width:{$bo_width}px"{/if}>
|
||||
<div id="container">
|
||||
{* begin HEADER *}
|
||||
<div id="header">
|
||||
<div id="header_infos">
|
||||
<a id="header_shopname" href="{$link->getAdminLink('AdminHome')}"><span>{$shop_name}</span></a><div id="notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<div id="orders_notif" class="notifs">
|
||||
<div id="header">
|
||||
<div id="header_infos">
|
||||
<a id="header_shopname" href="{$link->getAdminLink('AdminHome')}"><span>{$shop_name}</span></a><div id="notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<div id="orders_notif" class="notifs">
|
||||
<span id="orders_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been made on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if ($show_new_customers == 1)}
|
||||
<div id="customers_notif" class="notifs notifs_alternate">
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been made on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if ($show_new_customers == 1)}
|
||||
<div id="customers_notif" class="notifs notifs_alternate">
|
||||
<span id="customers_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<div id="customer_messages_notif" class="notifs">
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<div id="customer_messages_notif" class="notifs">
|
||||
<span id="customer_messages_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customer_messages_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customer_messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_customer_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="customer_messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_customer_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<span id="employee_links">
|
||||
<span class="employee_name">{$first_name} {$last_name}</span>
|
||||
<span class="separator"></span>
|
||||
<a class="employee" href="index.php?controller=AdminEmployees&id_employee={$employee->id}&updateemployee&token={getAdminToken tab='AdminEmployees'}" alt="" /> {l s='My preferences'}</a>
|
||||
<span class="separator"></span><a href="index.php?logout" id="header_logout">
|
||||
<span>{l s='logout'}</span>
|
||||
</a>
|
||||
{if {$base_url}}
|
||||
<span class="separator"></span> <a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}"><span>{l s='View my shop'}</span></a>
|
||||
{/if}
|
||||
<span class="separator"></span><a href="index.php?logout" id="header_logout">
|
||||
<span>{l s='logout'}</span>
|
||||
</a>
|
||||
{if {$base_url}}
|
||||
<span class="separator"></span> <a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}"><span>{l s='View my shop'}</span></a>
|
||||
{/if}
|
||||
</span>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={getAdminToken tab='AdminSearch'}">
|
||||
<input type="text" name="bo_query" id="bo_query" value="{$bo_query|htmlentities}" />
|
||||
<select name="bo_search_type" id="bo_search_type" class="chosen no-search">
|
||||
<option value="0">{l s='everywhere'}</option>
|
||||
<option value="1" {if {$search_type} == 1} selected="selected" {/if}>{l s='catalog'}</option>
|
||||
<optgroup label="{l s='customers'}:">
|
||||
<option value="2" {if {$search_type} == 2} selected="selected" {/if}>{l s='by name'}</option>
|
||||
<option value="6" {if {$search_type} == 6} selected="selected" {/if}>{l s='by ip address'}</option>
|
||||
</optgroup>
|
||||
<option value="3" {if {$search_type} == 3} selected="selected" {/if}>{l s='orders'}</option>
|
||||
<option value="4" {if {$search_type} == 4} selected="selected" {/if}>{l s='invoices'}</option>
|
||||
<option value="5" {if {$search_type} == 5} selected="selected" {/if}>{l s='carts'}</option>
|
||||
</select>
|
||||
<input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={getAdminToken tab='AdminSearch'}">
|
||||
<input type="text" name="bo_query" id="bo_query" value="{$bo_query|htmlentities}" />
|
||||
<select name="bo_search_type" id="bo_search_type" class="chosen no-search">
|
||||
<option value="0">{l s='everywhere'}</option>
|
||||
<option value="1" {if {$search_type} == 1} selected="selected" {/if}>{l s='catalog'}</option>
|
||||
<optgroup label="{l s='customers'}:">
|
||||
<option value="2" {if {$search_type} == 2} selected="selected" {/if}>{l s='by name'}</option>
|
||||
<option value="6" {if {$search_type} == 6} selected="selected" {/if}>{l s='by ip address'}</option>
|
||||
</optgroup>
|
||||
<option value="3" {if {$search_type} == 3} selected="selected" {/if}>{l s='orders'}</option>
|
||||
<option value="4" {if {$search_type} == 4} selected="selected" {/if}>{l s='invoices'}</option>
|
||||
<option value="5" {if {$search_type} == 5} selected="selected" {/if}>{l s='carts'}</option>
|
||||
</select>
|
||||
<input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{if count($quick_access) > 0}
|
||||
<div id="header_quick">
|
||||
<script type="text/javascript">
|
||||
function quickSelect(elt)
|
||||
{
|
||||
var eltVal = $(elt).val();
|
||||
if (eltVal == "0") return false;
|
||||
else if (eltVal.substr(eltVal.length - 6) == '_blank') window.open(eltVal.substr(0, eltVal.length - 6), '_blank');
|
||||
else location.href = eltVal;
|
||||
}
|
||||
</script>
|
||||
<select onchange="quickSelect(this);" id="quick_select" class="chosen no-search">
|
||||
<option value="0">{l s='Quick Access'}</option>
|
||||
{foreach $quick_access as $quick}
|
||||
<option value="{$quick.link}{if $quick.new_window}_blank{/if}">» {$quick.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
{if count($quick_access) > 0}
|
||||
<div id="header_quick">
|
||||
<script type="text/javascript">
|
||||
function quickSelect(elt)
|
||||
{
|
||||
var eltVal = $(elt).val();
|
||||
if (eltVal == "0") return false;
|
||||
else if (eltVal.substr(eltVal.length - 6) == '_blank') window.open(eltVal.substr(0, eltVal.length - 6), '_blank');
|
||||
else location.href = eltVal;
|
||||
}
|
||||
</script>
|
||||
<select onchange="quickSelect(this);" id="quick_select" class="chosen no-search">
|
||||
<option value="0">{l s='Quick Access'}</option>
|
||||
{foreach $quick_access as $quick}
|
||||
<option value="{$quick.link}{if $quick.new_window}_blank{/if}">» {$quick.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{hook h="displayBackOfficeTop"}
|
||||
</div>
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
{hook h="displayBackOfficeTop"}
|
||||
</div>
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{$t.name}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div> {* end header *}
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div> {* end header *}
|
||||
{/if}
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $display_header && $install_dir_exists}
|
||||
<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">
|
||||
{l s='For security reasons, you must also:'} {l s='delete the /install folder'}
|
||||
</div>
|
||||
{/if}
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $display_header && $install_dir_exists}
|
||||
<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">
|
||||
{l s='For security reasons, you must also:'} {l s='delete the /install folder'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $display_header && $is_multishop && ($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}
|
||||
</div>
|
||||
{/if}
|
||||
{if $display_header && $is_multishop && ($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}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
function module_blockwishlist_multishop()
|
||||
{
|
||||
$id_module = Db::getInstance()->getValue('SELECT id_module FROM '._DB_PREFIX_.'module where name="blockwishlist"');
|
||||
if ($id_module)
|
||||
{
|
||||
$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`');
|
||||
|
||||
return $res;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/* PHP:module_blockwishlist_multishop(); */;
|
||||
@@ -48,6 +48,11 @@ class WishList extends ObjectModel
|
||||
/** @var string Object last modification date */
|
||||
public $date_upd;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $id_shop;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $id_group_shop;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -60,6 +65,8 @@ class WishList extends ObjectModel
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -100,12 +107,20 @@ class WishList extends ObjectModel
|
||||
|
||||
public static function isExistsByNameForUser($name)
|
||||
{
|
||||
if (Shop::getContextShopID())
|
||||
$shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
elseif (Shop::getContextGroupShopID())
|
||||
$shop_restriction = 'AND id_group_shop = '.(int)Shop::getContextGroupShopID();
|
||||
else
|
||||
$shop_restriction = '';
|
||||
|
||||
$context = Context::getContext();
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) AS total
|
||||
FROM `'._DB_PREFIX_.'wishlist`
|
||||
WHERE `name` = \''.pSQL($name).'\'
|
||||
AND `id_customer` = '.(int)$context->customer->id
|
||||
AND `id_customer` = '.(int)$context->customer->id.'
|
||||
'.$shop_restriction
|
||||
);
|
||||
}
|
||||
|
||||
@@ -157,12 +172,20 @@ class WishList extends ObjectModel
|
||||
*/
|
||||
public static function getByIdCustomer($id_customer)
|
||||
{
|
||||
if (Shop::getContextShopID())
|
||||
$shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
elseif (Shop::getContextGroupShopID())
|
||||
$shop_restriction = 'AND id_group_shop = '.(int)Shop::getContextGroupShopID();
|
||||
else
|
||||
$shop_restriction = '';
|
||||
|
||||
if (!Validate::isUnsignedId($id_customer))
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance()->executeS('
|
||||
SELECT w.`id_wishlist`, w.`name`, w.`token`, w.`date_add`, w.`date_upd`, w.`counter`
|
||||
FROM `'._DB_PREFIX_.'wishlist` w
|
||||
WHERE `id_customer` = '.(int)($id_customer).'
|
||||
'.$shop_restriction.'
|
||||
ORDER BY w.`name` ASC'));
|
||||
}
|
||||
|
||||
@@ -178,7 +201,7 @@ class WishList extends ObjectModel
|
||||
WHERE (wp.id_wishlist='.(int)($id_wishlist).' AND o.id_cart IS NULL)
|
||||
HAVING timecart >= 3600*6');
|
||||
|
||||
if(isset($old_carts) AND $old_carts != false)
|
||||
if (isset($old_carts) AND $old_carts != false)
|
||||
foreach ($old_carts AS $old_cart)
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||
@@ -202,9 +225,9 @@ class WishList extends ObjectModel
|
||||
WHERE wp.id_wishlist='.(int)($id_wishlist)
|
||||
);
|
||||
|
||||
if(isset($res) AND $res != false)
|
||||
if (isset($res) AND $res != false)
|
||||
foreach ($res AS $refresh)
|
||||
if($refresh['wish_quantity'] > $refresh['cart_quantity'])
|
||||
if ($refresh['wish_quantity'] > $refresh['cart_quantity'])
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product`
|
||||
@@ -217,7 +240,7 @@ class WishList extends ObjectModel
|
||||
WHERE id_wishlist_product='.(int)($refresh['id_wishlist_product']).' AND id_cart='.(int)($refresh['id_cart'])
|
||||
);
|
||||
}
|
||||
if(isset($freshwish) AND $freshwish != false)
|
||||
if (isset($freshwish) AND $freshwish != false)
|
||||
foreach ($freshwish AS $prodcustomer)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
@@ -258,7 +281,8 @@ class WishList extends ObjectModel
|
||||
AND pl.`id_lang` = '.(int)($id_lang).'
|
||||
AND wp.`id_wishlist` = '.(int)($id_wishlist).
|
||||
(empty($id_product) === false ? ' AND wp.`id_product` = '.(int)($id_product) : '').
|
||||
($quantity == true ? ' AND wp.`quantity` != 0': ''));
|
||||
($quantity == true ? ' AND wp.`quantity` != 0': '').'
|
||||
GROUP BY p.id_product');
|
||||
if (empty($products) === true OR !sizeof($products))
|
||||
return array();
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
@@ -296,6 +320,13 @@ class WishList extends ObjectModel
|
||||
*/
|
||||
public static function getInfosByIdCustomer($id_customer)
|
||||
{
|
||||
if (Shop::getContextShopID())
|
||||
$shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
elseif (Shop::getContextGroupShopID())
|
||||
$shop_restriction = 'AND id_group_shop = '.(int)Shop::getContextGroupShopID();
|
||||
else
|
||||
$shop_restriction = '';
|
||||
|
||||
if (!Validate::isUnsignedId($id_customer))
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
@@ -303,6 +334,7 @@ class WishList extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
INNER JOIN `'._DB_PREFIX_.'wishlist` w ON (w.`id_wishlist` = wp.`id_wishlist`)
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).'
|
||||
'.$shop_restriction.'
|
||||
GROUP BY w.`id_wishlist`
|
||||
ORDER BY w.`name` ASC'));
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ class BlockWishList extends Module
|
||||
{
|
||||
const INSTALL_SQL_FILE = 'install.sql';
|
||||
|
||||
private $_html = '';
|
||||
private $_postErrors = array();
|
||||
private $_html = '';
|
||||
private $_postErrors = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -53,6 +53,9 @@ if ($context->customer->isLogged())
|
||||
if(!isset($context->cookie->id_wishlist) OR $context->cookie->id_wishlist == '')
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->id_shop = $context->shop->id;
|
||||
$wishlist->id_group_shop = $context->shop->id_group_shop;
|
||||
|
||||
$modWishlist = new BlockWishList();
|
||||
$wishlist->name = $modWishlist->default_wishlist_name;
|
||||
$wishlist->id_customer = (int)($context->customer->id);
|
||||
|
||||
@@ -81,6 +81,8 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
if(!sizeof($errors))
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->id_shop = $this->context->shop->id;
|
||||
$wishlist->id_group_shop = $this->context->shop->id_group_shop;
|
||||
$wishlist->name = $name;
|
||||
$wishlist->id_customer = (int)$this->context->customer->id;
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
|
||||
@@ -4,6 +4,8 @@ CREATE TABLE IF NOT EXISTS `PREFIX_wishlist` (
|
||||
`token` varchar(64) character set utf8 NOT NULL,
|
||||
`name` varchar(64) character set utf8 NOT NULL,
|
||||
`counter` int(10) unsigned NULL,
|
||||
`id_shop` int(10) unsigned default 1,
|
||||
`id_group_shop` int(10) unsigned default 1,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_wishlist`)
|
||||
|
||||
Reference in New Issue
Block a user