- | confirmUninstall) OR empty($module->confirmUninstall)}rel="false"{else}rel="{$module->confirmUninstall|addslashes}"{/if} class="noborder"> |
+
+ {if (isset($module->id) && $module->id > 0) || !isset($module->type) || $module->type != 'addonsMustHave'}
+ confirmUninstall) OR empty($module->confirmUninstall)}rel="false"{else}rel="{$module->confirmUninstall|addslashes}"{/if}
+ class="noborder">
+ {/if}
+ |
}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}) |
diff --git a/classes/Cart.php b/classes/Cart.php
index c84060653..93df46400 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -59,6 +59,9 @@ class CartCore extends ObjectModel
/** @var string Gift message if specified */
public $gift_message;
+ /** @var boolean Mobile Theme */
+ public $mobile_theme;
+
/** @var string Object creation date */
public $date_add;
@@ -109,6 +112,7 @@ class CartCore extends ObjectModel
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'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),
'secure_key' => array('type' => self::TYPE_STRING, 'size' => 32),
'allow_seperated_package' =>array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
@@ -119,12 +123,12 @@ class CartCore extends ObjectModel
protected $webserviceParameters = array(
'fields' => array(
- 'id_address_delivery' => array('xlink_resource' => 'addresses'),
- 'id_address_invoice' => array('xlink_resource' => 'addresses'),
- 'id_currency' => array('xlink_resource' => 'currencies'),
- 'id_customer' => array('xlink_resource' => 'customers'),
- 'id_guest' => array('xlink_resource' => 'guests'),
- 'id_lang' => array('xlink_resource' => 'languages'),
+ 'id_address_delivery' => array('xlink_resource' => 'addresses'),
+ 'id_address_invoice' => array('xlink_resource' => 'addresses'),
+ 'id_currency' => array('xlink_resource' => 'currencies'),
+ 'id_customer' => array('xlink_resource' => 'customers'),
+ 'id_guest' => array('xlink_resource' => 'guests'),
+ 'id_lang' => array('xlink_resource' => 'languages'),
),
'associations' => array(
'cart_rows' => array('resource' => 'cart_row', 'virtual_entity' => true, 'fields' => array(
diff --git a/classes/Context.php b/classes/Context.php
index 759e8c223..838273337 100644
--- a/classes/Context.php
+++ b/classes/Context.php
@@ -111,7 +111,7 @@ class ContextCore
$this->mobile_device = false;
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;
else
{
@@ -143,9 +143,25 @@ class ContextCore
{
// Check mobile context
if (Tools::isSubmit('no_mobile_theme'))
+ {
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;
+ 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'])
&& isset(Context::getContext()->cookie)
diff --git a/classes/Guest.php b/classes/Guest.php
index afbfef130..cd57912cd 100644
--- a/classes/Guest.php
+++ b/classes/Guest.php
@@ -40,6 +40,7 @@ class GuestCore extends ObjectModel
public $real_player;
public $windows_media;
public $accept_language;
+ public $mobile_theme;
/**
* @see ObjectModel::$definition
@@ -62,6 +63,7 @@ class GuestCore extends ObjectModel
'real_player' => 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),
+ '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'] : '';
$this->id_operating_system = $this->getOs($userAgent);
$this->id_web_browser = $this->getBrowser($userAgent);
- $this->accept_language = $this->getLanguage($acceptLanguage);
+ $this->mobile_theme = Context::getContext()->getMobileDevice();
}
protected function getLanguage($acceptLanguage)
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index be88e48bd..a2464ba9c 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -227,6 +227,7 @@ abstract class PaymentModuleCore extends Module
$order->recyclable = $this->context->cart->recyclable;
$order->gift = (int)$this->context->cart->gift;
$order->gift_message = $this->context->cart->gift_message;
+ $order->mobile_theme = $this->context->cart->mobile_theme;
$order->conversion_rate = $this->context->currency->conversion_rate;
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, 2) : $amount_paid;
$order->total_paid_real = 0;
diff --git a/classes/order/Order.php b/classes/order/Order.php
index afbd942d1..11cc76562 100644
--- a/classes/order/Order.php
+++ b/classes/order/Order.php
@@ -75,6 +75,9 @@ class OrderCore extends ObjectModel
/** @var string Gift message if specified */
public $gift_message;
+ /** @var boolean Mobile Theme */
+ public $mobile_theme;
+
/**
* @var string Shipping number
* @deprecated 1.5.0.4
@@ -176,6 +179,7 @@ class OrderCore extends ObjectModel
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'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_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_discounts_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php
index 82262267d..3d6c2f79d 100644
--- a/controllers/front/CartController.php
+++ b/controllers/front/CartController.php
@@ -213,6 +213,11 @@ class CartControllerCore extends FrontController
// Add cart if no cart found
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();
if ($this->context->cart->id)
$this->context->cookie->id_cart = (int)$this->context->cart->id;
diff --git a/install-dev/data/db_structure.sql b/install-dev/data/db_structure.sql
index 5e6c1ad09..522f28efe 100644
--- a/install-dev/data/db_structure.sql
+++ b/install-dev/data/db_structure.sql
@@ -181,6 +181,7 @@ CREATE TABLE `PREFIX_cart` (
`recyclable` tinyint(1) unsigned NOT NULL default '1',
`gift` tinyint(1) unsigned NOT NULL default '0',
`gift_message` text,
+ `mobile_theme` tinyint(1) NOT NULL default 0,
`allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
@@ -827,6 +828,7 @@ CREATE TABLE `PREFIX_guest` (
`real_player` tinyint(1) default NULL,
`windows_media` tinyint(1) default NULL,
`accept_language` varchar(8) default NULL,
+ `mobile_theme` tinyint(1) NOT NULL default 0,
PRIMARY KEY (`id_guest`),
KEY `id_customer` (`id_customer`),
KEY `id_operating_system` (`id_operating_system`),
@@ -1049,6 +1051,7 @@ CREATE TABLE `PREFIX_orders` (
`recyclable` tinyint(1) unsigned NOT NULL default '0',
`gift` tinyint(1) unsigned NOT NULL default '0',
`gift_message` text,
+ `mobile_theme` tinyint(1) NOT NULL default 0,
`shipping_number` varchar(32) default NULL,
`total_discounts` 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,
`value` 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`),
KEY `id_order` (`id_order`),
KEY `id_cart_rule` (`id_cart_rule`)
diff --git a/install-dev/upgrade/sql/1.5.4.0.sql b/install-dev/upgrade/sql/1.5.4.0.sql
index e846530e7..96cc876e5 100644
--- a/install-dev/upgrade/sql/1.5.4.0.sql
+++ b/install-dev/upgrade/sql/1.5.4.0.sql
@@ -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';
-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;
@@ -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`);
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`;
|