// Context part 17

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7688 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean committed 2011-07-22 09:35:28 +00:00
1 parent e62be3d793
commit e72ae93557
8 files changed
+30 -11

No files matched your search

+6
View File
@@ -30,9 +30,15 @@ define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php'); include(PS_ADMIN_DIR.'/../config/config.inc.php');
/* Header can't be included, so cookie must be created here */ /* Header can't be included, so cookie must be created here */
$context = Context::getContext();
$cookie = new Cookie('psAdmin'); $cookie = new Cookie('psAdmin');
if (!$cookie->id_employee) if (!$cookie->id_employee)
Tools::redirectAdmin('login.php'); Tools::redirectAdmin('login.php');
$context->employee = new Employee($cookie->id_employee);
$context->language = new Language($context->employee->id_lang);
$context->country = $defaultCountry;
$functionArray = array( $functionArray = array(
'pdf' => 'generateInvoicePDF', 'pdf' => 'generateInvoicePDF',
+5 -2
View File
@@ -258,10 +258,13 @@ class AdminCarts extends AdminTab
if (is_array($customizedDatas) AND isset($customizedDatas[(int)($product['id_product'])][(int)($product['id_product_attribute'])])) if (is_array($customizedDatas) AND isset($customizedDatas[(int)($product['id_product'])][(int)($product['id_product_attribute'])]))
{ {
$image = new Image($image['id_image']); if (isset($image['id_image']))
$image = new Image($image['id_image']);
else
$image = new Image();
echo ' echo '
<tr> <tr>
<td align="center">'.(isset($image['id_image']) ? cacheImage(_PS_IMG_DIR_.'p/'.$image->getExistingImgPath().'.jpg', <td align="center">'.($image->id ? cacheImage(_PS_IMG_DIR_.'p/'.$image->getExistingImgPath().'.jpg',
'product_mini_'.(int)($product['id_product']).(isset($product['id_product_attribute']) ? '_'.(int)($product['id_product_attribute']) : '').'.jpg', 45, 'jpg') : '--').'</td> 'product_mini_'.(int)($product['id_product']).(isset($product['id_product_attribute']) ? '_'.(int)($product['id_product_attribute']) : '').'.jpg', 45, 'jpg') : '--').'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product['id_product'].'&updateproduct&token='.$tokenCatalog.'"> <td><a href="index.php?tab=AdminCatalog&id_product='.$product['id_product'].'&updateproduct&token='.$tokenCatalog.'">
<span class="productName">'.$product['name'].'</span><br /> <span class="productName">'.$product['name'].'</span><br />
+2
View File
@@ -32,6 +32,7 @@ class AdminShipping extends AdminTab
public function __construct() public function __construct()
{ {
$context = Context::getContext();
$this->table = 'delivery'; $this->table = 'delivery';
$this->_fieldsHandling = array( $this->_fieldsHandling = array(
'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'), 'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
@@ -189,6 +190,7 @@ class AdminShipping extends AdminTab
public function displayFormFees() public function displayFormFees()
{ {
$context = Context::getContext();
$carrierArray = array(); $carrierArray = array();
$id_carrier = Tools::getValue('id_carrier'); $id_carrier = Tools::getValue('id_carrier');
$carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
+4 -3
View File
@@ -545,7 +545,6 @@ class CartCore extends ObjectModel
{ {
if (!$context) if (!$context)
$context = Context::getContext(); $context = Context::getContext();
$quantity = (int)$quantity; $quantity = (int)$quantity;
$id_product = (int)$id_product; $id_product = (int)$id_product;
$id_product_attribute = (int)$id_product_attribute; $id_product_attribute = (int)$id_product_attribute;
@@ -1590,6 +1589,8 @@ class CartCore extends ObjectModel
* Return custom pictures in this cart for a specified product * Return custom pictures in this cart for a specified product
* *
* @param int $id_product * @param int $id_product
* @param int $type only return customization of this type
* @param bool $not_in_cart only return customizations that are not in cart already
* @return array result rows * @return array result rows
*/ */
public function getProductCustomization($id_product, $type = null, $not_in_cart = false) public function getProductCustomization($id_product, $type = null, $not_in_cart = false)
@@ -1600,8 +1601,8 @@ class CartCore extends ObjectModel
ON cu.`id_customization` = cd.`id_customization` ON cu.`id_customization` = cd.`id_customization`
WHERE cu.id_cart = '.(int)$this->id.' WHERE cu.id_cart = '.(int)$this->id.'
AND cu.id_product = '.(int)$id_product. AND cu.id_product = '.(int)$id_product.
($type == 0 ? ' AND type = 0' : ''). ($type === _CUSTOMIZE_FILE_ ? ' AND type = '.(int)_CUSTOMIZE_FILE_ : '').
($type == 1 ? ' AND type = 1' : ''). ($type === _CUSTOMIZE_TEXTFIELD_ ? ' AND type = '.(int)_CUSTOMIZE_TEXTFIELD_ : '').
($not_in_cart ? ' AND in_cart = 0' : '') ($not_in_cart ? ' AND in_cart = 0' : '')
); );
return $result; return $result;
+8 -5
View File
@@ -3092,13 +3092,16 @@ class ProductCore extends ObjectModel
if (!$context) if (!$context)
$context = Context::getContext(); $context = Context::getContext();
$fields = array_merge($context->cookie->getFamily('pictures_'.(int)($this->id)), $context->cookie->getFamily('textFields_'.(int)($this->id))); $fields = $context->cart->getProductCustomization($this->id, null, true);
if (($requiredFields = $this->getRequiredCustomizableFields()) === false) if (($requiredFields = $this->getRequiredCustomizableFields()) === false)
return false; return false;
$prefix = array(_CUSTOMIZE_FILE_ => 'pictures_'.(int)($this->id).'_', _CUSTOMIZE_TEXTFIELD_ => 'textFields_'.(int)($this->id).'_');
foreach ($requiredFields AS $field) $fields_present = array();
if (!isset($fields[$prefix[$field['type']].$field['id_customization_field']]) OR empty($fields[$prefix[$field['type']].$field['id_customization_field']])) foreach ($fields as $field)
return false; $fields_present[] = array('id_customization_field' => $field['index'], 'type' => $field['type']);
foreach ($requiredFields AS $required_field)
if (!in_array($required_field, $fields_present))
return false;
return true; return true;
} }
+1
View File
@@ -172,6 +172,7 @@ class CartControllerCore extends FrontController
if ($context->cart->id) if ($context->cart->id)
$context->cookie->id_cart = (int)$context->cart->id; $context->cookie->id_cart = (int)$context->cart->id;
} }
if ($add AND !$producToAdd->hasAllRequiredCustomizableFields() AND !$customizationId) if ($add AND !$producToAdd->hasAllRequiredCustomizableFields() AND !$customizationId)
$this->errors[] = Tools::displayError('Please fill in all required fields, then save the customization.'); $this->errors[] = Tools::displayError('Please fill in all required fields, then save the customization.');
if (!sizeof($this->errors)) if (!sizeof($this->errors))
+1
View File
@@ -489,6 +489,7 @@ CREATE TABLE `PREFIX_customization` (
`quantity` int(10) NOT NULL, `quantity` int(10) NOT NULL,
`quantity_refunded` INT NOT NULL DEFAULT '0', `quantity_refunded` INT NOT NULL DEFAULT '0',
`quantity_returned` INT NOT NULL DEFAULT '0', `quantity_returned` INT NOT NULL DEFAULT '0',
`in_cart` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id_customization`,`id_cart`,`id_product`), PRIMARY KEY (`id_customization`,`id_cart`,`id_product`),
KEY `id_product_attribute` (`id_product_attribute`) KEY `id_product_attribute` (`id_product_attribute`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+3 -1
View File
@@ -300,8 +300,10 @@ CREATE TABLE `PREFIX_referrer_shop` (
INSERT INTO `PREFIX_referrer_shop` (`id_referrer`, `id_shop`) SELECT `id_referrer`, 1 FROM `PREFIX_referrer`; INSERT INTO `PREFIX_referrer_shop` (`id_referrer`, `id_shop`) SELECT `id_referrer`, 1 FROM `PREFIX_referrer`;
ALTER TABLE `PREFIX_referrer` DROP `cache_visitors`, DROP `cache_visits`, DROP `cache_pages`, DROP `cache_registrations`, DROP `cache_orders`, DROP `cache_sales`, DROP `cache_reg_rate`, DROP `cache_order_rate`; ALTER TABLE `PREFIX_referrer` DROP `cache_visitors`, DROP `cache_visits`, DROP `cache_pages`, DROP `cache_registrations`, DROP `cache_orders`, DROP `cache_sales`, DROP `cache_reg_rate`, DROP `cache_order_rate`;
ALTER TABLE PREFIX_employee ADD `show_screencast` tinyint(1) unsigned NOT NULL default '1'; ALTER TABLE `PREFIX_employee` ADD `show_screencast` TINYINT(1) UNSIGNED NOT NULL default '1';
ALTER TABLE `PREFIX_cart_product` ADD `id_shop` INT NOT NULL DEFAULT '1' AFTER `id_product`; ALTER TABLE `PREFIX_cart_product` ADD `id_shop` INT NOT NULL DEFAULT '1' AFTER `id_product`;
ALTER TABLE `PREFIX_customization` ADD `in_cart` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';
/* PHP:create_multistore(); */ /* PHP:create_multistore(); */