diff --git a/admin-dev/themes/template/products/combinations.tpl b/admin-dev/themes/template/products/combinations.tpl index 883afec07..d061f0185 100644 --- a/admin-dev/themes/template/products/combinations.tpl +++ b/admin-dev/themes/template/products/combinations.tpl @@ -7,7 +7,7 @@ updateMvtStatus($(this).val()); }); updateMvtStatus($(this).val()); - + if ( $("input[name=is_virtual_file]:checked").val() == 1) { $("#virtual_good_attributes").show(); @@ -18,7 +18,7 @@ $("#virtual_good_attributes").hide(); $("#is_virtual_file_product").hide(); } - + $("input[name=is_virtual_file]").live("change", function() { if($(this).val() == "1") { @@ -31,7 +31,7 @@ $("#is_virtual_file_product").hide(); } }); - }); + }); - + {l s='No Tax'} @@ -658,10 +656,10 @@ $(document).ready(function(){ {l s='Unit price without tax:' } {$currency->prefix} {$currency->suffix} + onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');"/>{$currency->suffix} {l s='per'} {if $ps_tax && $country_display_tax_label} - {l s='or'} + {l s='or'} {$currency->prefix}0.00{$currency->suffix} {l s='per'} {$product->unity} {l s='with tax'} @@ -697,7 +695,7 @@ $(document).ready(function(){ {* [end] prices *} - + {if !$ps_stock_management} @@ -716,7 +714,7 @@ $(document).ready(function(){ {l s='Additional shipping cost:'} - {$currency->prefix}{$currency->prefix}{$currency->suffix} {if $country_display_tax_label}{l s='tax excl.'}{/if} {l s='Carrier tax will be applied.'} @@ -725,9 +723,9 @@ $(document).ready(function(){ {l s='Displayed text when in-stock:'} - {include file="products/input_text_lang.tpl" - languages=$languages - input_value=$product->available_now + {include file="products/input_text_lang.tpl" + languages=$languages + input_value=$product->available_now input_name='available_now'} {l s='Forbidden characters:'} <>;=#{} @@ -735,15 +733,15 @@ $(document).ready(function(){ {l s='Displayed text when allowed to be back-ordered:'} - {include file="products/input_text_lang.tpl" - languages=$languages + {include file="products/input_text_lang.tpl" + languages=$languages input_value=$product->available_later input_name='available_later'} {l s='Forbidden characters:'} <>;=#{} {if $countAttributes} - + {* .(($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00').'" *} {l s='Available date:'} @@ -760,13 +758,13 @@ $(document).ready(function(){ {l s='When out of stock:'} - out_of_stock == 0}checked="checked"{/if} /> + out_of_stock == 0}checked="checked"{/if} /> {l s='Deny orders'} - out_of_stock == 1}checked="checked"{/if} /> + out_of_stock == 1}checked="checked"{/if} /> {l s='Allow orders'} - out_of_stock == 2}checked="checked"{/if} /> - {l s='Default:'} - {if $ps_order_out_of_stock}{l s='Allow orders'}{else}{l s='Deny orders'}{/if} ({l s='as set in'} out_of_stock == 2}checked="checked"{/if} /> + {l s='Default:'} + {if $ps_order_out_of_stock}{l s='Allow orders'}{else}{l s='Deny orders'}{/if} ({l s='as set in'} {l s='Preferences'}) @@ -775,7 +773,7 @@ $(document).ready(function(){ - + {l s='Default category:'} @@ -805,9 +803,9 @@ $(document).ready(function(){ {l s='Meta title:'} - {include file="products/input_text_lang.tpl" - languages=$languages - input_name='meta_title' + {include file="products/input_text_lang.tpl" + languages=$languages + input_name='meta_title' input_value=$product->meta_title} {l s='Product page title; leave blank to use product name'} @@ -815,9 +813,9 @@ $(document).ready(function(){ {l s='Meta description:'} - {include file="products/input_text_lang.tpl" - languages=$languages - input_name='meta_description' + {include file="products/input_text_lang.tpl" + languages=$languages + input_name='meta_description' input_value=$product->meta_description input_hint='{l s=\'Forbidden characters:\'\} <>;=#{\}' } @@ -827,7 +825,7 @@ $(document).ready(function(){ {l s='Meta keywords:'} - {include file="products/input_text_lang.tpl" languages=$languages + {include file="products/input_text_lang.tpl" languages=$languages input_value=$product->meta_keywords input_name='meta_keywords'} {l s='Keywords for HTML header, separated by a comma'} @@ -836,15 +834,15 @@ $(document).ready(function(){ {l s='Friendly URL:'} - {include file="products/input_text_lang.tpl" - languages=$languages - input_value=$product->link_rewrite + {include file="products/input_text_lang.tpl" + languages=$languages + input_value=$product->link_rewrite input_name='link_rewrite'} - {l s='Generate'} {l s='Friendly-url from product\'s name.'} - {l s='Product link will look like this:'} + {l s='Product link will look like this:'} {if $ps_ssl_enabled}https://{else}http://{/if}{*$smarty.server.SERVER_NAME*}/id_product-.html @@ -855,8 +853,8 @@ $(document).ready(function(){ {l s='Short description:'}({l s='appears in the product lists and on the top of the product page'}) - {include file="products/textarea_lang.tpl" - languages=$languages + {include file="products/textarea_lang.tpl" + languages=$languages input_name='description_short' input_value=$product->description_short} @@ -865,8 +863,8 @@ $(document).ready(function(){ {l s='Description:'}({l s='appears in the body of the product page'}) - - {include file="products/textarea_lang.tpl" languages=$languages + + {include file="products/textarea_lang.tpl" languages=$languages input_name='description' input_value=$product->description } @@ -875,7 +873,7 @@ $(document).ready(function(){ {if $images} - + @@ -921,11 +919,11 @@ $(document).ready(function(){ {$type.name} ({$type.width}px par {$type.height}px) {/foreach} - + - + {l s='Image tag to insert:'} @@ -938,7 +936,7 @@ $(document).ready(function(){ - + + + + 8. {l s='Quantities'} + + + + + {l s='Available stock in warehouses'} + + + + + + {l s='There is %s quantities available in stock for this product'|sprintf:$total_quantity} + + + + + + + + {l s='Quantity'} + {l s='Designation'} + + + + {foreach from=$attributes item=attribute} + + {$physical_quantity[$attribute['id_product_attribute']]} + {$product_designation[$attribute['id_product_attribute']]} + + {/foreach} + + + + + + + + + + + + {l s='Available quantities for sale'} + + + + + + + + + + + + + + depends_on_stock == 1}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/> + {l s='Available quantities for current product and its combinations are based on stock in the warehouses'} + + + + + + depends_on_stock == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/> + {l s='I want to specify available quantities manually, and manage my stock independently'} + + + + + + + + + {l s='Quantity'} + {l s='Designation'} + + + + {foreach from=$attributes item=attribute} + + + {$available_quantity[$attribute['id_product_attribute']]} + + + {$product_designation[$attribute['id_product_attribute']]} + + {/foreach} + + + + + + + + + + {l s='When out of stock:'} + + out_of_stock == 0}checked="checked" {/if} id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock"> + {l s='Deny orders'} + + out_of_stock == 1} 'checked="checked" {/if} id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock"> + {l s='Allow orders'} + + out_of_stock == 2} 'checked="checked" {/if} id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock"> + + Default: + Deny orders + {assign var=confirm value="Are you sure you want to delete entered product information?"} + + {l s='as set in Preferences'} + + + + + + + + + + + \ No newline at end of file diff --git a/admin-dev/themes/template/products/suppliers.tpl b/admin-dev/themes/template/products/suppliers.tpl new file mode 100644 index 000000000..a940860e3 --- /dev/null +++ b/admin-dev/themes/template/products/suppliers.tpl @@ -0,0 +1,95 @@ + + + + + {l s='Suppliers of the current product'} + + + + + +{l s='Please choose the suppliers associated to this product, and the default one.'} +{assign var=confirm value="Are you sure you want to delete entered product information?"} + + {l s='Create new supplier'} + + + + + + + + + {l s='Selected'} + {l s='Supplier Name'} + {l s='Default'} + + + + {foreach from=$suppliers item=supplier} + + + {$supplier['name']} + + + {/foreach} + + + + + + + + + + + + + + + {l s='Product reference(s)'} + + + + + +{l s='You can specify product reference(s) for each supplier associated.'} + + + + + + + + {l s='Product Name'} + {foreach from=$associated_suppliers item=supplier} + {$supplier->name} + {/foreach} + + + + {foreach from=$attributes item=attribute} + + {$product_designation[$attribute['id_product_attribute']]} + {foreach from=$associated_suppliers item=supplier} + {assign var=reference value=''} + {foreach from=$associated_suppliers_collection item=asc} + {if $asc->id_product == $attribute['id_product'] && $asc->id_product_attribute == $attribute['id_product_attribute'] && $asc->id_supplier == $supplier->id_supplier} + {assign var=reference value=$asc->product_supplier_reference} + {/if} + {/foreach} + + + + {/foreach} + + {/foreach} + + + + + + + + + diff --git a/admin-dev/themes/template/suppliers/view.tpl b/admin-dev/themes/template/suppliers/view.tpl index 908d5c57c..e4c755b2b 100644 --- a/admin-dev/themes/template/suppliers/view.tpl +++ b/admin-dev/themes/template/suppliers/view.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -34,24 +34,24 @@ {foreach $products AS $product} {if !$product->hasAttributes()} - + {$product->name} {if !empty($product->reference)}{l s='Ref:'} {$product->reference}{/if} {if !empty($product->ean13)}{l s='EAN13:'} {$product->ean13}{/if} {if !empty($product->upc)}{l s='UPC:'} {$product->upc}{/if} - {if $stock_management}{l s='Qty:'} {$product->quantity}{/if} + {if $stock_management}{l s='Available Quantity:'} {$product->quantity}{/if} {else} {$product->name} - + {l s='Attribute name'} {l s='Reference'} {l s='EAN13'} {l s='UPC'} - {if $stock_management}{l s='Quantity'}{/if} + {if $stock_management}{l s='Available Quantity'}{/if} {foreach $product->combinaison AS $id_product_attribute => $product_attribute} diff --git a/admin-dev/themes/template/supply_orders/form.tpl b/admin-dev/themes/template/supply_orders/form.tpl index 768093b36..bd2ac4938 100644 --- a/admin-dev/themes/template/supply_orders/form.tpl +++ b/admin-dev/themes/template/supply_orders/form.tpl @@ -115,7 +115,7 @@ - '; + } - $this->tpl_form_vars['custom_form'] = $content; + $data->assign(array( + 'attributes' => $attributes, + 'suppliers' => $suppliers, + 'default_supplier' => $default_supplier, + 'associated_suppliers' => $associated_suppliers, + 'associated_suppliers_collection' => $product_supplier_collection, + 'product_designation' => $product_designation, + 'product' => $this->object, + 'link' => $this->context->link, + 'token' => $this->token + )); + } + else + $data->assign('content', ''.$this->l('You must save this product before manage suppliers').'.'); + + $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); } public function initFormFeatures($obj) @@ -3214,23 +3181,6 @@ if (false) $data->assign('default_form_language', $this->default_form_language); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); } - - protected function getCarrierList() - { - $carrier_list = Carrier::getCarriers($this->context->language->id); - if ($product = $this->loadObject(true)) - { - $carrier_selected_list = $product->getCarriers(); - foreach ($carrier_list as &$carrier) - foreach ($carrier_selected_list as $carrier_selected) - if ($carrier_selected['id_reference'] == $carrier['id_reference']) - { - $carrier['selected'] = true; - continue; - } - } - return $carrier_list; - } public function ajaxProcessProductQuantity() { @@ -3359,8 +3309,6 @@ if (false) $this->tpl_form_vars['input_namepack_items'] = $input_namepack_items; } - - public function updatePackItems($product) { Pack::deleteItems($product->id); diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 4d42700ab..bfa59c968 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -1022,11 +1022,14 @@ class AdminSupplyOrdersControllerCore extends AdminController //get the product name in the order language $entry->name = Product::getProductName($entry->id_product, $entry->id_product_attribute, $supply_order->id_lang); - //get the product name displayed in the backoffice according to the employee language - $entry->name_displayed = Tools::getValue('input_name_'.$id, ''); - if (empty($entry->name)) - $entry->name = $entry->name_displayed; + $entry->name = ''; + + //get the product supplier reference + $entry->supplier_reference = ProductSupplier::getProductSupplierReference($entry->id_product, $entry->id_product_attribute, $supply_order->id_supplier); + + if ($entry->supplier_reference == null) + $entry->supplier_reference = ''; $entry->exchange_rate = $currency->conversion_rate; $entry->id_currency = $currency->id; @@ -1034,6 +1037,9 @@ class AdminSupplyOrdersControllerCore extends AdminController $errors = $entry->validateController(); + //get the product name displayed in the backoffice according to the employee language + $entry->name_displayed = Tools::getValue('input_name_'.$id, ''); + // if there is a problem, handle error for the current product if (count($errors) > 0) { @@ -1098,14 +1104,20 @@ class AdminSupplyOrdersControllerCore extends AdminController if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) )) $this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.')); - // specify initial state - $_POST['id_supply_order_state'] = 1; //defaut creation state + if (!count($this->_errors)) + { + // specify initial state + $_POST['id_supply_order_state'] = 1; //defaut creation state - // specify global reference currency - $_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id; + // specify global reference currency + $_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id; - //specific discount check - $_POST['discount_rate'] = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0)); + // specify supplier name + $_POST['supplier_name'] = Supplier::getNameById($id_supplier); + + //specific discount check + $_POST['discount_rate'] = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0)); + } // manage each associated product $this->manageOrderProducts(); @@ -1499,6 +1511,14 @@ class AdminSupplyOrdersControllerCore extends AdminController // re-defines fieldsDisplay $this->fieldsDisplay = array( + 'supplier_reference' => array( + 'title' => $this->l('Supplier Reference'), + 'align' => 'center', + 'width' => 120, + 'orderby' => false, + 'filter' => false, + 'search' => false, + ), 'reference' => array( 'title' => $this->l('Reference'), 'align' => 'center', @@ -1637,6 +1657,7 @@ class AdminSupplyOrdersControllerCore extends AdminController 'supply_order_detail_content' => $content, 'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''), 'supply_order_reference' => $supply_order->reference, + 'supply_order_supplier_name' => $supply_order->supplier_name, 'supply_order_creation_date' => Tools::displayDate($supply_order->date_add, $lang_id, true), 'supply_order_last_update' => Tools::displayDate($supply_order->date_upd, $lang_id, true), 'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected, $lang_id, true), diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index 31f530f99..a038bb6ba 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -2100,6 +2100,7 @@ CREATE TABLE `PREFIX_stock_available` ( CREATE TABLE `PREFIX_supply_order` ( `id_supply_order` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `id_supplier` INT(11) UNSIGNED NOT NULL, +`supplier_name` VARCHAR(64) NOT NULL, `id_lang` INT(11) UNSIGNED NOT NULL, `id_warehouse` INT(11) UNSIGNED NOT NULL, `id_supply_order_state` INT(11) UNSIGNED NOT NULL, @@ -2128,6 +2129,7 @@ CREATE TABLE `PREFIX_supply_order_detail` ( `id_product` INT(11) UNSIGNED NOT NULL, `id_product_attribute` INT(11) UNSIGNED NOT NULL, `reference` VARCHAR(32) NOT NULL, +`supplier_reference` VARCHAR(32) NOT NULL, `name` varchar(128) NOT NULL, `ean13` VARCHAR(13) DEFAULT NULL, `upc` VARCHAR(12) DEFAULT NULL, @@ -2197,15 +2199,23 @@ CREATE TABLE `PREFIX_supply_order_receipt_history` ( KEY `id_supply_order_state` (`id_supply_order_state`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; +CREATE TABLE `PREFIX_product_supplier` ( + `id_product_supplier` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `id_product` int(11) UNSIGNED NOT NULL, + `id_product_attribute` int(11) UNSIGNED NOT NULL DEFAULT '0', + `id_supplier` int(11) UNSIGNED NOT NULL, + `product_supplier_reference` varchar(32) DEFAULT NULL, + PRIMARY KEY (`id_product_supplier`), + UNIQUE KEY `id_product` (`id_product`,`id_product_attribute`,`id_supplier`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + CREATE TABLE `PREFIX_supplier_rates` ( -`id_product` INT(11) UNSIGNED NOT NULL, -`id_product_attribute` INT(11) UNSIGNED NOT NULL, -`id_supplier` INT(11) UNSIGNED NOT NULL, +`id_product_supplier` INT(11) UNSIGNED NOT NULL, `id_currency` INT(11) UNSIGNED NOT NULL, `quantity_min` INT(11) UNSIGNED NOT NULL, `quantity_max` INT(11) UNSIGNED NOT NULL, `price_te` DECIMAL(20,6) DEFAULT '0.000000', - PRIMARY KEY (`id_product`, `id_product_attribute`, `id_supplier`, `quantity_min`, `quantity_max`) + PRIMARY KEY (`id_product_supplier`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_accounting_zone_shop` ( diff --git a/install-dev/sql/db_settings_extends.sql b/install-dev/sql/db_settings_extends.sql index 7024a714b..e1bcc62f4 100644 --- a/install-dev/sql/db_settings_extends.sql +++ b/install-dev/sql/db_settings_extends.sql @@ -220,6 +220,12 @@ INSERT INTO `PREFIX_product` (`id_product`, `indexed`, `id_supplier`, `id_manufa (8, 1, 0, 0, 1, 3, 0, 1, '0', 0.00, 0, 25.041806, 0.000000, '', NULL, 0, 2, 0, 0, 0, 0, 1, NOW(), NOW(), '0000-00-00'), (9, 1, 2, 2, 1, 3, 0, 1, '0', 0.00, 0, 124.581940, 0.000000, '', NULL, 0, 2, 0, 0, 0, 0, 1, NOW(), NOW(), '0000-00-00'); +INSERT INTO `PREFIX_product_supplier` (`id_product_supplier`, `id_product`, `id_product_attribute`, `id_supplier`, `product_supplier_reference`) VALUES +(1, 1, 0, 1, ''), +(2, 2, 0, 1, ''), +(3, 6, 0, 1, ''), +(4, 7, 0, 1, ''); + INSERT INTO `PREFIX_product_shop` (`id_product`, `id_shop`) (SELECT `id_product`, 1 FROM `PREFIX_product`); INSERT INTO `PREFIX_product_lang` (`id_product`, `id_lang`, `description`, `description_short`, `link_rewrite`, `meta_description`, `meta_keywords`, `meta_title`, `name`, `available_now`, `available_later`) VALUES diff --git a/js/attributesBack.js b/js/attributesBack.js index fad1d3ac4..ae3a8a2a9 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, +function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference, ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date, virtual_product_name_attribute, virtual_product_filename_attribute, virtual_product_nb_downloable, virtual_product_expiration_date_attribute, virtual_product_nb_days, is_shareable) @@ -52,7 +52,6 @@ virtual_product_nb_days, is_shareable) getE('virtual_product_expiration_date_attribute').value = virtual_product_expiration_date_attribute; getE('virtual_product_nb_days_attribute').value = virtual_product_nb_days; - getE('attribute_supplier_reference').value = supplier_reference; getE('attribute_ean13').value = ean; getE('attribute_upc').value = upc; getE('submitProductAttribute').value = modifyattributegroup;
{l s='Carrier tax will be applied.'}
{l s='Product page title; leave blank to use product name'}
{l s='Keywords for HTML header, separated by a comma'}
- {l s='Generate'} {l s='Friendly-url from product\'s name.'} - {l s='Product link will look like this:'} + {l s='Product link will look like this:'} {if $ps_ssl_enabled}https://{else}http://{/if}{*$smarty.server.SERVER_NAME*}/id_product-.html
{l s='There is %s quantities available in stock for this product'|sprintf:$total_quantity}
{l s='Please choose the suppliers associated to this product, and the default one.'}
{l s='You can specify product reference(s) for each supplier associated.'}