[+] Core : added a boolean in the database (guest/cart/order) in order to know if the customer used the mobile theme for the order
This commit is contained in:
1 parent
a753bfc23e
commit
8b2e9fb08e
9 files changed
+57
-12
No files matched your search
@@ -43,7 +43,13 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{foreach from=$modules item=module}
|
{foreach from=$modules item=module}
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="checkbox" name="modules" value="{$module->name}" {if !isset($module->confirmUninstall) OR empty($module->confirmUninstall)}rel="false"{else}rel="{$module->confirmUninstall|addslashes}"{/if} class="noborder"></td>
|
<td>
|
||||||
|
{if (isset($module->id) && $module->id > 0) || !isset($module->type) || $module->type != 'addonsMustHave'}
|
||||||
|
<input type="checkbox" name="modules" value="{$module->name}"
|
||||||
|
{if !isset($module->confirmUninstall) OR empty($module->confirmUninstall)}rel="false"{else}rel="{$module->confirmUninstall|addslashes}"{/if}
|
||||||
|
class="noborder">
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
|
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="moduleDesc" id="anchor{$module->name|ucfirst}">
|
<div class="moduleDesc" id="anchor{$module->name|ucfirst}">
|
||||||
|
|||||||
+10
-6
@@ -59,6 +59,9 @@ class CartCore extends ObjectModel
|
|||||||
/** @var string Gift message if specified */
|
/** @var string Gift message if specified */
|
||||||
public $gift_message;
|
public $gift_message;
|
||||||
|
|
||||||
|
/** @var boolean Mobile Theme */
|
||||||
|
public $mobile_theme;
|
||||||
|
|
||||||
/** @var string Object creation date */
|
/** @var string Object creation date */
|
||||||
public $date_add;
|
public $date_add;
|
||||||
|
|
||||||
@@ -109,6 +112,7 @@ class CartCore extends ObjectModel
|
|||||||
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
|
'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
|
||||||
|
'mobile_theme' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'delivery_option' => array('type' => self::TYPE_STRING),
|
'delivery_option' => array('type' => self::TYPE_STRING),
|
||||||
'secure_key' => array('type' => self::TYPE_STRING, 'size' => 32),
|
'secure_key' => array('type' => self::TYPE_STRING, 'size' => 32),
|
||||||
'allow_seperated_package' =>array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'allow_seperated_package' =>array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
@@ -119,12 +123,12 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
protected $webserviceParameters = array(
|
protected $webserviceParameters = array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'id_address_delivery' => array('xlink_resource' => 'addresses'),
|
'id_address_delivery' => array('xlink_resource' => 'addresses'),
|
||||||
'id_address_invoice' => array('xlink_resource' => 'addresses'),
|
'id_address_invoice' => array('xlink_resource' => 'addresses'),
|
||||||
'id_currency' => array('xlink_resource' => 'currencies'),
|
'id_currency' => array('xlink_resource' => 'currencies'),
|
||||||
'id_customer' => array('xlink_resource' => 'customers'),
|
'id_customer' => array('xlink_resource' => 'customers'),
|
||||||
'id_guest' => array('xlink_resource' => 'guests'),
|
'id_guest' => array('xlink_resource' => 'guests'),
|
||||||
'id_lang' => array('xlink_resource' => 'languages'),
|
'id_lang' => array('xlink_resource' => 'languages'),
|
||||||
),
|
),
|
||||||
'associations' => array(
|
'associations' => array(
|
||||||
'cart_rows' => array('resource' => 'cart_row', 'virtual_entity' => true, 'fields' => array(
|
'cart_rows' => array('resource' => 'cart_row', 'virtual_entity' => true, 'fields' => array(
|
||||||
|
|||||||
+18
-2
@@ -111,7 +111,7 @@ class ContextCore
|
|||||||
$this->mobile_device = false;
|
$this->mobile_device = false;
|
||||||
if ($this->checkMobileContext())
|
if ($this->checkMobileContext())
|
||||||
{
|
{
|
||||||
if(isset(Context::getContext()->cookie->no_mobile) && Context::getContext()->cookie->no_mobile == false AND (int)Configuration::get('PS_ALLOW_MOBILE_DEVICE') != 0)
|
if (isset(Context::getContext()->cookie->no_mobile) && Context::getContext()->cookie->no_mobile == false AND (int)Configuration::get('PS_ALLOW_MOBILE_DEVICE') != 0)
|
||||||
$this->mobile_device = true;
|
$this->mobile_device = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,9 +143,25 @@ class ContextCore
|
|||||||
{
|
{
|
||||||
// Check mobile context
|
// Check mobile context
|
||||||
if (Tools::isSubmit('no_mobile_theme'))
|
if (Tools::isSubmit('no_mobile_theme'))
|
||||||
|
{
|
||||||
Context::getContext()->cookie->no_mobile = true;
|
Context::getContext()->cookie->no_mobile = true;
|
||||||
else if (Tools::isSubmit('mobile_theme_ok'))
|
if (Context::getContext()->cookie->id_guest)
|
||||||
|
{
|
||||||
|
$guest = new Guest(Context::getContext()->cookie->id_guest);
|
||||||
|
$guest->mobile_theme = false;
|
||||||
|
$guest->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (Tools::isSubmit('mobile_theme_ok'))
|
||||||
|
{
|
||||||
Context::getContext()->cookie->no_mobile = false;
|
Context::getContext()->cookie->no_mobile = false;
|
||||||
|
if (Context::getContext()->cookie->id_guest)
|
||||||
|
{
|
||||||
|
$guest = new Guest(Context::getContext()->cookie->id_guest);
|
||||||
|
$guest->mobile_theme = true;
|
||||||
|
$guest->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return isset($_SERVER['HTTP_USER_AGENT'])
|
return isset($_SERVER['HTTP_USER_AGENT'])
|
||||||
&& isset(Context::getContext()->cookie)
|
&& isset(Context::getContext()->cookie)
|
||||||
|
|||||||
+3
-1
@@ -40,6 +40,7 @@ class GuestCore extends ObjectModel
|
|||||||
public $real_player;
|
public $real_player;
|
||||||
public $windows_media;
|
public $windows_media;
|
||||||
public $accept_language;
|
public $accept_language;
|
||||||
|
public $mobile_theme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ObjectModel::$definition
|
* @see ObjectModel::$definition
|
||||||
@@ -62,6 +63,7 @@ class GuestCore extends ObjectModel
|
|||||||
'real_player' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'real_player' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'windows_media' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'windows_media' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'accept_language' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 8),
|
'accept_language' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 8),
|
||||||
|
'mobile_theme' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ class GuestCore extends ObjectModel
|
|||||||
$acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
|
$acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
|
||||||
$this->id_operating_system = $this->getOs($userAgent);
|
$this->id_operating_system = $this->getOs($userAgent);
|
||||||
$this->id_web_browser = $this->getBrowser($userAgent);
|
$this->id_web_browser = $this->getBrowser($userAgent);
|
||||||
$this->accept_language = $this->getLanguage($acceptLanguage);
|
$this->mobile_theme = Context::getContext()->getMobileDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLanguage($acceptLanguage)
|
protected function getLanguage($acceptLanguage)
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$order->recyclable = $this->context->cart->recyclable;
|
$order->recyclable = $this->context->cart->recyclable;
|
||||||
$order->gift = (int)$this->context->cart->gift;
|
$order->gift = (int)$this->context->cart->gift;
|
||||||
$order->gift_message = $this->context->cart->gift_message;
|
$order->gift_message = $this->context->cart->gift_message;
|
||||||
|
$order->mobile_theme = $this->context->cart->mobile_theme;
|
||||||
$order->conversion_rate = $this->context->currency->conversion_rate;
|
$order->conversion_rate = $this->context->currency->conversion_rate;
|
||||||
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, 2) : $amount_paid;
|
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, 2) : $amount_paid;
|
||||||
$order->total_paid_real = 0;
|
$order->total_paid_real = 0;
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ class OrderCore extends ObjectModel
|
|||||||
/** @var string Gift message if specified */
|
/** @var string Gift message if specified */
|
||||||
public $gift_message;
|
public $gift_message;
|
||||||
|
|
||||||
|
/** @var boolean Mobile Theme */
|
||||||
|
public $mobile_theme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Shipping number
|
* @var string Shipping number
|
||||||
* @deprecated 1.5.0.4
|
* @deprecated 1.5.0.4
|
||||||
@@ -176,6 +179,7 @@ class OrderCore extends ObjectModel
|
|||||||
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
|
'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
|
||||||
|
'mobile_theme' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'total_discounts' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
'total_discounts' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||||
'total_discounts_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
'total_discounts_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||||
'total_discounts_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
'total_discounts_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||||
|
|||||||
@@ -213,6 +213,11 @@ class CartControllerCore extends FrontController
|
|||||||
// Add cart if no cart found
|
// Add cart if no cart found
|
||||||
if (!$this->context->cart->id)
|
if (!$this->context->cart->id)
|
||||||
{
|
{
|
||||||
|
if (Context::getContext()->cookie->id_guest)
|
||||||
|
{
|
||||||
|
$guest = new Guest(Context::getContext()->cookie->id_guest);
|
||||||
|
$this->context->cart->mobile_theme = $guest->mobile_theme;
|
||||||
|
}
|
||||||
$this->context->cart->add();
|
$this->context->cart->add();
|
||||||
if ($this->context->cart->id)
|
if ($this->context->cart->id)
|
||||||
$this->context->cookie->id_cart = (int)$this->context->cart->id;
|
$this->context->cookie->id_cart = (int)$this->context->cart->id;
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ CREATE TABLE `PREFIX_cart` (
|
|||||||
`recyclable` tinyint(1) unsigned NOT NULL default '1',
|
`recyclable` tinyint(1) unsigned NOT NULL default '1',
|
||||||
`gift` tinyint(1) unsigned NOT NULL default '0',
|
`gift` tinyint(1) unsigned NOT NULL default '0',
|
||||||
`gift_message` text,
|
`gift_message` text,
|
||||||
|
`mobile_theme` tinyint(1) NOT NULL default 0,
|
||||||
`allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
`allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`date_add` datetime NOT NULL,
|
`date_add` datetime NOT NULL,
|
||||||
`date_upd` datetime NOT NULL,
|
`date_upd` datetime NOT NULL,
|
||||||
@@ -827,6 +828,7 @@ CREATE TABLE `PREFIX_guest` (
|
|||||||
`real_player` tinyint(1) default NULL,
|
`real_player` tinyint(1) default NULL,
|
||||||
`windows_media` tinyint(1) default NULL,
|
`windows_media` tinyint(1) default NULL,
|
||||||
`accept_language` varchar(8) default NULL,
|
`accept_language` varchar(8) default NULL,
|
||||||
|
`mobile_theme` tinyint(1) NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_guest`),
|
PRIMARY KEY (`id_guest`),
|
||||||
KEY `id_customer` (`id_customer`),
|
KEY `id_customer` (`id_customer`),
|
||||||
KEY `id_operating_system` (`id_operating_system`),
|
KEY `id_operating_system` (`id_operating_system`),
|
||||||
@@ -1049,6 +1051,7 @@ CREATE TABLE `PREFIX_orders` (
|
|||||||
`recyclable` tinyint(1) unsigned NOT NULL default '0',
|
`recyclable` tinyint(1) unsigned NOT NULL default '0',
|
||||||
`gift` tinyint(1) unsigned NOT NULL default '0',
|
`gift` tinyint(1) unsigned NOT NULL default '0',
|
||||||
`gift_message` text,
|
`gift_message` text,
|
||||||
|
`mobile_theme` tinyint(1) NOT NULL default 0,
|
||||||
`shipping_number` varchar(32) default NULL,
|
`shipping_number` varchar(32) default NULL,
|
||||||
`total_discounts` decimal(17,2) NOT NULL default '0.00',
|
`total_discounts` decimal(17,2) NOT NULL default '0.00',
|
||||||
`total_discounts_tax_incl` decimal(17,2) NOT NULL default '0.00',
|
`total_discounts_tax_incl` decimal(17,2) NOT NULL default '0.00',
|
||||||
@@ -1182,7 +1185,7 @@ CREATE TABLE `PREFIX_order_cart_rule` (
|
|||||||
`name` varchar(254) NOT NULL,
|
`name` varchar(254) NOT NULL,
|
||||||
`value` decimal(17,2) NOT NULL default '0.00',
|
`value` decimal(17,2) NOT NULL default '0.00',
|
||||||
`value_tax_excl` decimal(17,2) NOT NULL default '0.00',
|
`value_tax_excl` decimal(17,2) NOT NULL default '0.00',
|
||||||
`free_shipping` BOOLEAN NOT NULL DEFAULT FALSE,
|
`free_shipping` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id_order_cart_rule`),
|
PRIMARY KEY (`id_order_cart_rule`),
|
||||||
KEY `id_order` (`id_order`),
|
KEY `id_order` (`id_order`),
|
||||||
KEY `id_cart_rule` (`id_cart_rule`)
|
KEY `id_cart_rule` (`id_cart_rule`)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ UPDATE `PREFIX_customer` c, `PREFIX_orders` o SET c.id_lang = o.id_lang WHERE c.
|
|||||||
|
|
||||||
UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminCartRules&addcart_rule' WHERE `link` = 'index.php?tab=AdminDiscounts&adddiscount';
|
UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminCartRules&addcart_rule' WHERE `link` = 'index.php?tab=AdminDiscounts&adddiscount';
|
||||||
|
|
||||||
ALTER TABLE `PREFIX_order_cart_rule` ADD `free_shipping` BOOLEAN NOT NULL DEFAULT FALSE AFTER `value_tax_excl`;
|
ALTER TABLE `PREFIX_order_cart_rule` ADD `free_shipping` tinyint(1) NOT NULL DEFAULT 0 AFTER `value_tax_excl`;
|
||||||
|
|
||||||
UPDATE `PREFIX_order_cart_rule` ocr, `PREFIX_cart_rule` cr SET ocr.free_shipping = 1 WHERE ocr.id_cart_rule = cr.id_cart_rule AND cr.free_shipping = 1;
|
UPDATE `PREFIX_order_cart_rule` ocr, `PREFIX_cart_rule` cr SET ocr.free_shipping = 1 WHERE ocr.id_cart_rule = cr.id_cart_rule AND cr.free_shipping = 1;
|
||||||
|
|
||||||
@@ -37,3 +37,7 @@ ALTER TABLE `PREFIX_stock_available` DROP INDEX `product_sqlstock`;
|
|||||||
ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`);
|
ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`);
|
||||||
|
|
||||||
UPDATE PREFIX_configuration SET `value` = '8388608' WHERE `name` = 'PS_PRODUCT_PICTURE_MAX_SIZE' AND `value` <= '524288';
|
UPDATE PREFIX_configuration SET `value` = '8388608' WHERE `name` = 'PS_PRODUCT_PICTURE_MAX_SIZE' AND `value` <= '524288';
|
||||||
|
|
||||||
|
ALTER TABLE `PREFIX_guest` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE `PREFIX_orders` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0 AFTER `gift_message`;
|
||||||
|
ALTER TABLE `PREFIX_cart` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0 AFTER `gift_message`;
|
||||||
Reference in new issue
Block a user