From 95d5d50af4df8450f47490bf544bf2bf07662a4f Mon Sep 17 00:00:00 2001 From: vChabot Date: Tue, 13 Sep 2011 14:52:42 +0000 Subject: [PATCH] // changing name "available_date_combi" to "available_date" and some features --- admin-dev/tabs/AdminProducts.php | 19 +++++++++++-------- classes/Combination.php | 6 +++--- classes/Product.php | 6 +++--- controllers/ProductController.php | 4 ++-- install-dev/sql/db.sql | 2 +- install-dev/sql/upgrade/1.5.0.1.sql | 4 ++-- js/attributesBack.js | 8 ++++---- modules/ebay/config.xml | 2 +- themes/prestashop/js/product.js | 20 ++++++++++---------- themes/prestashop/product.tpl | 2 +- translations/fr/admin.php | 2 ++ 11 files changed, 40 insertions(+), 35 deletions(-) diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index 9b5d103d4..d0122b8d8 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -484,7 +484,7 @@ class AdminProducts extends AdminTab $this->_errors[] = Tools::displayError('This attribute already exists.'); else { - if (Validate::isDateFormat(Tools::getValue('available_date_combi'))) + if (Validate::isDateFormat(Tools::getValue('available_date'))) { $product->updateProductAttribute($id_product_attribute, Tools::getValue('attribute_wholesale_price'), @@ -501,7 +501,7 @@ class AdminProducts extends AdminTab Tools::getValue('attribute_location'), Tools::getValue('attribute_upc'), Tools::getValue('minimal_quantity'), - Tools::getValue('available_date_combi')); + Tools::getValue('available_date')); if ($id_reason = (int)Tools::getValue('id_mvt_reason') AND (int)Tools::getValue('attribute_mvt_quantity') > 0 AND $id_reason > 0) { @@ -2653,6 +2653,7 @@ class AdminProducts extends AdminTab '.$this->l('Available date:').' +

'.$this->l('The available date when this product is out of stock').'

'; // date picker include @@ -3365,13 +3366,15 @@ class AdminProducts extends AdminTab '.$this->l('Quantity in stock:').' - - '.$this->l('Available date:').' - + + '.$this->l('Available date:').' + +

'.$this->l('The available date when this product is out of stock').'

+ '; // date picker include include_once('functions.php'); - includeDatepicker('available_date_combi'); + includeDatepicker('available_date'); echo '
@@ -3441,7 +3444,7 @@ class AdminProducts extends AdminTab $combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13']; $combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc']; $combArray[$combinaison['id_product_attribute']]['minimal_quantity'] = $combinaison['minimal_quantity']; - $combArray[$combinaison['id_product_attribute']]['available_date_combi'] = strftime($combinaison['available_date_combi']); + $combArray[$combinaison['id_product_attribute']]['available_date'] = strftime($combinaison['available_date']); $combArray[$combinaison['id_product_attribute']]['location'] = $combinaison['location']; $combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity']; $combArray[$combinaison['id_product_attribute']]['id_image'] = isset($combinationImages[$combinaison['id_product_attribute']][0]['id_image']) ? $combinationImages[$combinaison['id_product_attribute']][0]['id_image'] : 0; @@ -3471,7 +3474,7 @@ class AdminProducts extends AdminTab $list = rtrim($list, ', '); $jsList = rtrim($jsList, ', '); $attrImage = $product_attribute['id_image'] ? new Image($product_attribute['id_image']) : false; - $available_date = ($product_attribute['available_date_combi'] != 0) ? date('Y-m-j', strtotime($product_attribute['available_date_combi'])) : '00-00-0000'; + $available_date = ($product_attribute['available_date'] != 0) ? date('Y-m-j', strtotime($product_attribute['available_date'])) : '00-00-0000'; echo ' '.stripslashes($list).' diff --git a/classes/Combination.php b/classes/Combination.php index 8823fb85a..e371358bd 100644 --- a/classes/Combination.php +++ b/classes/Combination.php @@ -51,7 +51,7 @@ class CombinationCore extends ObjectModel public $default_on; - public $available_date_combi; + public $available_date; protected $fieldsRequired = array( 'id_product', @@ -78,7 +78,7 @@ class CombinationCore extends ObjectModel 'quantity' => 'isUnsignedInt', 'weight' => 'isFloat', 'default_on' => 'isBool', - 'available_date_combi' => 'isDate', + 'available_date' => 'isDateFormat', ); protected $table = 'product_attribute'; @@ -111,7 +111,7 @@ class CombinationCore extends ObjectModel $fields['quantity'] = (int)($this->quantity); $fields['weight'] = pSQL($this->weight); $fields['default_on'] = (int)($this->default_on); - $fields['available_date_combi'] = pSQL($this->available_date_combi); + $fields['available_date'] = pSQL($this->available_date); return $fields; } diff --git a/classes/Product.php b/classes/Product.php index 585eb0b7b..a3d4223f0 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1041,7 +1041,7 @@ class ProductCore extends ObjectModel * @param string $minimal_quantity Minimal quantity * @return array Update result */ - public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location = NULL, $upc = NULL, $minimal_quantity, $available_date_combi) + public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location = NULL, $upc = NULL, $minimal_quantity, $available_date) { Db::getInstance()->Execute(' DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` @@ -1062,7 +1062,7 @@ class ProductCore extends ObjectModel 'upc' => pSQL($upc), 'default_on' => (int)($default), 'minimal_quantity' => (int)($minimal_quantity), - 'available_date_combi' => pSQL($available_date_combi) + 'available_date' => pSQL($available_date) ); if ($quantity) @@ -2298,7 +2298,7 @@ class ProductCore extends ObjectModel if (!Combination::isFeatureActive()) return array(); $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, - a.`color` AS attribute_color, pa.`id_product_attribute`, stock.quantity, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`, pa.`minimal_quantity`, pa.`available_date_combi` + a.`color` AS attribute_color, pa.`id_product_attribute`, stock.quantity, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`, pa.`minimal_quantity`, pa.`available_date` FROM `'._DB_PREFIX_.'product_attribute` pa '.Product::sqlStock('pa', 'pa').' LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` diff --git a/controllers/ProductController.php b/controllers/ProductController.php index c08726317..ea2de43dc 100644 --- a/controllers/ProductController.php +++ b/controllers/ProductController.php @@ -290,7 +290,7 @@ class ProductControllerCore extends FrontController $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int)($row['quantity']); //french date format - $availableDateCombi = date('j-m-Y',strtotime($row['available_date_combi'])); + $availableDate = date('j-m-Y',strtotime($row['available_date'])); $combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name']; $combinations[$row['id_product_attribute']]['attributes'][] = (int)($row['id_attribute']); @@ -301,7 +301,7 @@ class ProductControllerCore extends FrontController $combinations[$row['id_product_attribute']]['reference'] = $row['reference']; $combinations[$row['id_product_attribute']]['unit_impact'] = $row['unit_price_impact']; $combinations[$row['id_product_attribute']]['minimal_quantity'] = $row['minimal_quantity']; - $combinations[$row['id_product_attribute']]['available_date_combi'] = $availableDateCombi; + $combinations[$row['id_product_attribute']]['available_date'] = $availableDate; $combinations[$row['id_product_attribute']]['id_image'] = isset($combinationImages[$row['id_product_attribute']][0]['id_image']) ? $combinationImages[$row['id_product_attribute']][0]['id_image'] : -1; } diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index e50ac59a8..c1f89507f 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -1210,7 +1210,7 @@ CREATE TABLE `PREFIX_product_attribute` ( `unit_price_impact` decimal(17,2) NOT NULL default '0.00', `default_on` tinyint(1) unsigned NOT NULL default '0', `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1', - `available_date_combi` datetime NOT NULL, + `available_date` datetime NOT NULL, PRIMARY KEY (`id_product_attribute`), KEY `product_attribute_product` (`id_product`), KEY `reference` (`reference`), diff --git a/install-dev/sql/upgrade/1.5.0.1.sql b/install-dev/sql/upgrade/1.5.0.1.sql index 5bd4936fc..951d1b347 100644 --- a/install-dev/sql/upgrade/1.5.0.1.sql +++ b/install-dev/sql/upgrade/1.5.0.1.sql @@ -72,6 +72,6 @@ INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VAL ('PS_FEATURE_FEATURE_ACTIVE', '1', NOW(), NOW()), ('PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW()); -ALTER TABLE `PREFIX_product` ADD `available_date` DATETIME NOT NULL AFTER `available_for_order` +ALTER TABLE `PREFIX_product` ADD `available_date` DATETIME NOT NULL AFTER `available_for_order`; -ALTER TABLE `ps_product_attribute` ADD `available_date_combi` DATETIME NOT NULL +ALTER TABLE `PREFIX_product_attribute` ADD `available_date` DATETIME NOT NULL; diff --git a/js/attributesBack.js b/js/attributesBack.js index 90c5bbb80..19b427b75 100644 --- a/js/attributesBack.js +++ b/js/attributesBack.js @@ -26,7 +26,7 @@ var storeUsedGroups = {}; -function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference, supplier_reference, ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date_combi) +function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference, supplier_reference, ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date) { init_elems(); $('#stock_mvt_attribute').show(); @@ -34,10 +34,10 @@ function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impa $('#attribute_quantity').html(quantity); $('#attribute_quantity').show(); $('#attr_qty_stock').show(); - if(available_date_combi!=undefined) - getE('available_date_combi').value = available_date_combi; + if(available_date!=undefined) + getE('available_date').value = available_date; else - getE('available_date_combi').value = '0000-00-00'; + getE('available_date').value = '0000-00-00'; getE('minimal_quantity').value = minimal_quantity; getE('attribute_reference').value = reference; getE('attribute_supplier_reference').value = supplier_reference; diff --git a/modules/ebay/config.xml b/modules/ebay/config.xml index 504a112c0..2f7992d34 100755 --- a/modules/ebay/config.xml +++ b/modules/ebay/config.xml @@ -9,4 +9,4 @@ 1 1 - + \ No newline at end of file diff --git a/themes/prestashop/js/product.js b/themes/prestashop/js/product.js index f49a96d0a..d04528a7f 100644 --- a/themes/prestashop/js/product.js +++ b/themes/prestashop/js/product.js @@ -50,7 +50,7 @@ function oosHookJsCode() } //add a combination of attributes in the global JS sytem -function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference, unit_price, minimal_quantity, available_date_combi) +function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference, unit_price, minimal_quantity, available_date) { globalQuantity += quantity; @@ -64,7 +64,7 @@ function addCombination(idCombination, arrayOfIdAttributes, quantity, price, eco combination['reference'] = reference; combination['unit_price'] = unit_price; combination['minimal_quantity'] = minimal_quantity; - combination['available_date_combi'] = available_date_combi; + combination['available_date'] = available_date; combinations.push(combination); } @@ -121,7 +121,7 @@ function findCombination(firstTime) displayImage( $('#thumb_'+combinations[combination]['image']).parent() ); //get available_date for combination product - selectedCombination['available_date_combi'] = combinations[combination]['available_date_combi']; + selectedCombination['available_date'] = combinations[combination]['available_date']; //update the display updateDisplay(); @@ -243,15 +243,15 @@ function updateDisplay() $('#availability_statut:hidden').show(); //display availability date - var date_combi = selectedCombination['available_date_combi']; - tab_date = date_combi.split('-'); - var time_combi = new Date(tab_date[2], tab_date[1], tab_date[0]); - time_combi.setMonth(time_combi.getMonth()-1); + var available_date = selectedCombination['available_date']; + tab_date = available_date.split('-'); + var time_available = new Date(tab_date[2], tab_date[1], tab_date[0]); + time_available.setMonth(time_available.getMonth()-1); var now = new Date(); - // date displayed only if time_combi - if (now.getTime() < time_combi.getTime()) + // date displayed only if time_available + if (now.getTime() < time_available.getTime()) { - $('#availability_date_value').text(selectedCombination['available_date_combi']); + $('#availability_date_value').text(selectedCombination['available_date']); $('#availability_date_label').show(); $('#availability_date_value').show(); } diff --git a/themes/prestashop/product.tpl b/themes/prestashop/product.tpl index bcc28733d..f34429e34 100644 --- a/themes/prestashop/product.tpl +++ b/themes/prestashop/product.tpl @@ -108,7 +108,7 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus {if isset($groups)} // Combinations {foreach from=$combinations key=idCombination item=combination} - addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity}, '{$combination.available_date_combi}'); + addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity}, '{$combination.available_date}'); {/foreach} // Colors {if $colors|@count > 0} diff --git a/translations/fr/admin.php b/translations/fr/admin.php index aa3b0fada..5d43ad28a 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -2209,6 +2209,7 @@ $_LANGADM['AdminProductsb6ef48322d4d59004db9f650344c1a8f'] = 'La taxe du transpo $_LANGADM['AdminProducts3e565755572fa5df48eb811c62619098'] = 'Message quand en stock :'; $_LANGADM['AdminProducts3e053943605d9e4bf7dd7588ea19e9d2'] = 'Caractères interdits :'; $_LANGADM['AdminProducts627b9f5acc2dcec1e8e341dd09df9768'] = 'Message lorsque hors-stock mais commandable :'; +$_LANGADM['AdminProducts915f8462b0f5459dcca1d52b0a2297d5'] = 'Date de disponibilité :'; $_LANGADM['AdminProducts24a1199bf4dcbef398db7660409a61d9'] = 'Si rupture de stock :'; $_LANGADM['AdminProductsf072da215c080d985d44361e96a3cf60'] = 'Refuser les commandes'; $_LANGADM['AdminProducts119a7c88cf8f1c685c57981abff26f43'] = 'Accepter les commandes'; @@ -2277,6 +2278,7 @@ $_LANGADM['AdminProductsad802655c2e83ad378868d5f448677c7'] = 'Impact sur le prix $_LANGADM['AdminProducts487fd4fe388baed0928898b641050983'] = 'Eco-participation :'; $_LANGADM['AdminProductsf445f4a540768234833908cab83f9214'] = 'écrase l\'information d\'éco-participation du produit'; $_LANGADM['AdminProducts24bf9597daf212b5cfab26ca381e7008'] = 'Mouvement de stock :'; +$_LANGADM['AdminProducts4b5ecb6f4e1496fb2c2b28fa0f41872a'] = 'La date de disponibilité du produit lorsqu\'il n\'est plus en stock'; $_LANGADM['AdminProducts461900b74731e07320ca79366df3e809'] = 'Image :'; $_LANGADM['AdminProducts29d7b46b863639e29ae8452d2320530a'] = 'Faire de cette déclinaison celle par défaut pour ce produit'; $_LANGADM['AdminProductsadbabbab7becdf5ef8736a64466df260'] = 'Ajouter cette déclinaison';