[-] FO : Fix Bug PSCFI-7016 available date on product page
This commit is contained in:
@@ -267,7 +267,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td style="padding-bottom:5px;">
|
<td style="padding-bottom:5px;">
|
||||||
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
|
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
|
||||||
{l s='Make this combination the default combination for this product'}<br /><br />
|
<label for="attribute_default" style="float:none;">{l s='Make this combination the default combination for this product'}</label><br /><br />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
+20
-5
@@ -653,11 +653,14 @@ class ProductCore extends ObjectModel
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updateDefaultAttribute($id_product)
|
public function setAvailableDate($available_date = '0000-00-00')
|
||||||
{
|
{
|
||||||
Db::getInstance()->update('product_shop', array(
|
if (Validate::isDateFormat($available_date) && $this->available_date != $available_date)
|
||||||
'cache_default_attribute' => (int)Product::getDefaultAttribute($id_product),
|
{
|
||||||
), 'id_product = '.(int)$id_product);
|
$this->available_date = $available_date;
|
||||||
|
return $this->update();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updateIsVirtual($id_product)
|
public static function updateIsVirtual($id_product)
|
||||||
@@ -1252,7 +1255,19 @@ class ProductCore extends ObjectModel
|
|||||||
$result &= ObjectModel::updateMultishopTable('product', array(
|
$result &= ObjectModel::updateMultishopTable('product', array(
|
||||||
'cache_default_attribute' => (int)$id_product_attribute,
|
'cache_default_attribute' => (int)$id_product_attribute,
|
||||||
), 'a.`id_product` = '.(int)$this->id);
|
), 'a.`id_product` = '.(int)$this->id);
|
||||||
|
$this->cache_default_attribute = (int)$id_product_attribute;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateDefaultAttribute($id_product)
|
||||||
|
{
|
||||||
|
$id_default_attribute = (int)Product::getDefaultAttribute($id_product);
|
||||||
|
$result = Db::getInstance()->update('product_shop', array(
|
||||||
|
'cache_default_attribute' => $id_default_attribute,
|
||||||
|
), 'id_product = '.(int)$id_product);
|
||||||
|
$result &= Db::getInstance()->update('product', array(
|
||||||
|
'cache_default_attribute' => $id_default_attribute,
|
||||||
|
), 'id_product = '.(int)$id_product);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2962,7 +2977,7 @@ class ProductCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there is not a default attribute and create it not
|
* Check if there is no default attribute and create it if not
|
||||||
*/
|
*/
|
||||||
public function checkDefaultAttributes()
|
public function checkDefaultAttributes()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -680,6 +680,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
if (!isset($_POST['attribute_ecotax'])) $_POST['attribute_ecotax'] = 0;
|
if (!isset($_POST['attribute_ecotax'])) $_POST['attribute_ecotax'] = 0;
|
||||||
if (Tools::getValue('attribute_default'))
|
if (Tools::getValue('attribute_default'))
|
||||||
$product->deleteDefaultAttributes();
|
$product->deleteDefaultAttributes();
|
||||||
|
|
||||||
// Change existing one
|
// Change existing one
|
||||||
if (($id_product_attribute = (int)Tools::getValue('id_product_attribute')) || ($id_product_attribute = $product->productAttributeExists(Tools::getValue('attribute_combination_list'), false, null, true, true)))
|
if (($id_product_attribute = (int)Tools::getValue('id_product_attribute')) || ($id_product_attribute = $product->productAttributeExists(Tools::getValue('attribute_combination_list'), false, null, true, true)))
|
||||||
{
|
{
|
||||||
@@ -703,11 +704,10 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
Tools::getValue('attribute_location'),
|
Tools::getValue('attribute_location'),
|
||||||
Tools::getValue('attribute_upc'),
|
Tools::getValue('attribute_upc'),
|
||||||
$this->isProductFieldUpdated('attribute_minimal_quantity') ? Tools::getValue('attribute_minimal_quantity') : null,
|
$this->isProductFieldUpdated('attribute_minimal_quantity') ? Tools::getValue('attribute_minimal_quantity') : null,
|
||||||
$this->isProductFieldUpdated('available_date_attribute') ? Tools::getValue('available_date_attribute') : null,
|
$this->isProductFieldUpdated('available_date_attribute') ? Tools::getValue('available_date_attribute') : null, false);
|
||||||
false);
|
|
||||||
StockAvailable::setProductDependsOnStock((int)$product->id, $product->depends_on_stock, null, (int)$id_product_attribute);
|
StockAvailable::setProductDependsOnStock((int)$product->id, $product->depends_on_stock, null, (int)$id_product_attribute);
|
||||||
StockAvailable::setProductOutOfStock((int)$product->id, $product->out_of_stock, null, (int)$id_product_attribute);
|
StockAvailable::setProductOutOfStock((int)$product->id, $product->out_of_stock, null, (int)$id_product_attribute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||||
@@ -749,11 +749,14 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$combination = new Combination((int)$id_product_attribute);
|
$combination = new Combination((int)$id_product_attribute);
|
||||||
$combination->setAttributes(Tools::getValue('attribute_combination_list'));
|
$combination->setAttributes(Tools::getValue('attribute_combination_list'));
|
||||||
$product->checkDefaultAttributes();
|
$product->checkDefaultAttributes();
|
||||||
}
|
if (Tools::getValue('attribute_default'))
|
||||||
if (!count($this->errors))
|
{
|
||||||
{
|
Product::updateDefaultAttribute((int)$product->id);
|
||||||
if (!$product->cache_default_attribute)
|
if(isset($id_product_attribute))
|
||||||
Product::updateDefaultAttribute($product->id);
|
$product->cache_default_attribute = (int)$id_product_attribute;
|
||||||
|
if ($available_date = Tools::getValue('available_date_attribute'))
|
||||||
|
$product->setAvailableDate($available_date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1958,10 +1961,10 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
public function updateDownloadProduct($product, $edit = 0)
|
public function updateDownloadProduct($product, $edit = 0)
|
||||||
{
|
{
|
||||||
$is_virtual_file = (int)Tools::getValue('is_virtual_file');
|
$is_virtual_file = (int)Tools::getValue('is_virtual_file');
|
||||||
$product->setDefaultAttribute(0);//reset cache_default_attribute
|
|
||||||
// add or update a virtual product
|
// add or update a virtual product
|
||||||
if (Tools::getValue('is_virtual_good') == 'true')
|
if (Tools::getValue('is_virtual_good') == 'true')
|
||||||
{
|
{
|
||||||
|
$product->setDefaultAttribute(0);//reset cache_default_attribute
|
||||||
if (Tools::getValue('virtual_product_expiration_date') && !Validate::isDate(Tools::getValue('virtual_product_expiration_date') && !empty($is_virtual_file)))
|
if (Tools::getValue('virtual_product_expiration_date') && !Validate::isDate(Tools::getValue('virtual_product_expiration_date') && !empty($is_virtual_file)))
|
||||||
{
|
{
|
||||||
if (!Tools::getValue('virtual_product_expiration_date'))
|
if (!Tools::getValue('virtual_product_expiration_date'))
|
||||||
@@ -3547,7 +3550,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$data->assign('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id));
|
$data->assign('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id));
|
||||||
$data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
|
$data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
|
||||||
$data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
|
$data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
|
||||||
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $this->context->language->id))) : '0000-00-00');
|
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities($this->getFieldValue($product, 'available_date'), $this->context->language->id)) : '0000-00-00');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$data->assign('imageType', ImageType::getByNameNType('small_default', 'products'));
|
$data->assign('imageType', ImageType::getByNameNType('small_default', 'products'));
|
||||||
@@ -4126,10 +4129,10 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
public function updatePackItems($product)
|
public function updatePackItems($product)
|
||||||
{
|
{
|
||||||
Pack::deleteItems($product->id);
|
Pack::deleteItems($product->id);
|
||||||
$product->setDefaultAttribute(0);//reset cache_default_attribute
|
|
||||||
// lines format: QTY x ID-QTY x ID
|
// lines format: QTY x ID-QTY x ID
|
||||||
if (Tools::getValue('type_product') == Product::PTYPE_PACK)
|
if (Tools::getValue('type_product') == Product::PTYPE_PACK)
|
||||||
{
|
{
|
||||||
|
$product->setDefaultAttribute(0);//reset cache_default_attribute
|
||||||
$items = Tools::getValue('inputPackItems');
|
$items = Tools::getValue('inputPackItems');
|
||||||
$lines = array_unique(explode('-', $items));
|
$lines = array_unique(explode('-', $items));
|
||||||
// lines is an array of string with format : QTYxID
|
// lines is an array of string with format : QTYxID
|
||||||
|
|||||||
@@ -407,10 +407,6 @@ class ProductControllerCore extends FrontController
|
|||||||
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
|
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
|
||||||
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int)$row['quantity'];
|
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int)$row['quantity'];
|
||||||
|
|
||||||
if ($row['available_date'] != '0000-00-00 00:00:00' && $row['available_date'] != '0000-00-00')
|
|
||||||
$available_date = Tools::displayDate($row['available_date'], $this->context->language->id);
|
|
||||||
else
|
|
||||||
$available_date = $row['available_date'];
|
|
||||||
|
|
||||||
$combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name'];
|
$combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name'];
|
||||||
$combinations[$row['id_product_attribute']]['attributes'][] = (int)$row['id_attribute'];
|
$combinations[$row['id_product_attribute']]['attributes'][] = (int)$row['id_attribute'];
|
||||||
@@ -429,7 +425,10 @@ class ProductControllerCore extends FrontController
|
|||||||
$combinations[$row['id_product_attribute']]['reference'] = $row['reference'];
|
$combinations[$row['id_product_attribute']]['reference'] = $row['reference'];
|
||||||
$combinations[$row['id_product_attribute']]['unit_impact'] = $row['unit_price_impact'];
|
$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']]['minimal_quantity'] = $row['minimal_quantity'];
|
||||||
$combinations[$row['id_product_attribute']]['available_date'] = $available_date;
|
if ($row['available_date'] != '0000-00-00')
|
||||||
|
$combinations[$row['id_product_attribute']]['available_date'] = $row['available_date'];
|
||||||
|
else
|
||||||
|
$combinations[$row['id_product_attribute']]['available_date'] = '';
|
||||||
|
|
||||||
if (isset($combination_images[$row['id_product_attribute']][0]['id_image']))
|
if (isset($combination_images[$row['id_product_attribute']][0]['id_image']))
|
||||||
$combinations[$row['id_product_attribute']]['id_image'] = $combination_images[$row['id_product_attribute']][0]['id_image'];
|
$combinations[$row['id_product_attribute']]['id_image'] = $combination_images[$row['id_product_attribute']][0]['id_image'];
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ span.view_scroll_spacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#availability_statut span#availability_label,
|
#availability_statut span#availability_label,
|
||||||
#availability_statut span#availability_date_label {
|
#availability_date_label {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
width:125px;
|
width:125px;
|
||||||
font-weight:700;
|
font-weight:700;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function oosHookJsCode()
|
|||||||
for (var i = 0; i < oosHookJsCodeFunctions.length; i++)
|
for (var i = 0; i < oosHookJsCodeFunctions.length; i++)
|
||||||
{
|
{
|
||||||
if (function_exists(oosHookJsCodeFunctions[i]))
|
if (function_exists(oosHookJsCodeFunctions[i]))
|
||||||
setTimeout(oosHookJsCodeFunctions[i]+'()', 0);
|
setTimeout(oosHookJsCodeFunctions[i] + '()', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ function addCombination(idCombination, arrayOfIdAttributes, quantity, price, eco
|
|||||||
combination['reference'] = reference;
|
combination['reference'] = reference;
|
||||||
combination['unit_price'] = unit_price;
|
combination['unit_price'] = unit_price;
|
||||||
combination['minimal_quantity'] = minimal_quantity;
|
combination['minimal_quantity'] = minimal_quantity;
|
||||||
|
combination['available_date'] = [];
|
||||||
combination['available_date'] = available_date;
|
combination['available_date'] = available_date;
|
||||||
combination['specific_price'] = [];
|
combination['specific_price'] = [];
|
||||||
combination['specific_price'] = combination_specific_price;
|
combination['specific_price'] = combination_specific_price;
|
||||||
@@ -88,9 +89,7 @@ function findCombination(firstTime)
|
|||||||
$.each(combinations[combination]['idsAttributes'], function(key, value)
|
$.each(combinations[combination]['idsAttributes'], function(key, value)
|
||||||
{
|
{
|
||||||
if (!in_array(value, choice))
|
if (!in_array(value, choice))
|
||||||
{
|
|
||||||
combinationMatchForm = false;
|
combinationMatchForm = false;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (combinationMatchForm)
|
if (combinationMatchForm)
|
||||||
@@ -119,7 +118,7 @@ function findCombination(firstTime)
|
|||||||
|
|
||||||
//show the large image in relation to the selected combination
|
//show the large image in relation to the selected combination
|
||||||
if (combinations[combination]['image'] && combinations[combination]['image'] != -1)
|
if (combinations[combination]['image'] && combinations[combination]['image'] != -1)
|
||||||
displayImage( $('#thumb_'+combinations[combination]['image']).parent() );
|
displayImage( $('#thumb_' + combinations[combination]['image']).parent() );
|
||||||
|
|
||||||
//show discounts values according to the selected combination
|
//show discounts values according to the selected combination
|
||||||
if (combinations[combination]['idCombination'] && combinations[combination]['idCombination'] > 0)
|
if (combinations[combination]['idCombination'] && combinations[combination]['idCombination'] > 0)
|
||||||
@@ -141,6 +140,8 @@ function findCombination(firstTime)
|
|||||||
}
|
}
|
||||||
//this combination doesn't exist (not created in back office)
|
//this combination doesn't exist (not created in back office)
|
||||||
selectedCombination['unavailable'] = true;
|
selectedCombination['unavailable'] = true;
|
||||||
|
if (typeof(selectedCombination['available_date']) != 'undefined')
|
||||||
|
delete selectedCombination['available_date'];
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,9 +159,7 @@ function updateDisplay()
|
|||||||
//hide the hook out of stock
|
//hide the hook out of stock
|
||||||
$('#oosHook').hide();
|
$('#oosHook').hide();
|
||||||
|
|
||||||
//hide availability date
|
$('#availability_date').fadeOut();
|
||||||
$('#availability_date_label').hide();
|
|
||||||
$('#availability_date_value').hide();
|
|
||||||
|
|
||||||
//availability value management
|
//availability value management
|
||||||
if (availableNowValue != '')
|
if (availableNowValue != '')
|
||||||
@@ -172,16 +171,13 @@ function updateDisplay()
|
|||||||
$('#availability_statut:hidden').show();
|
$('#availability_statut:hidden').show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
//hide the availability value
|
|
||||||
$('#availability_statut:visible').hide();
|
$('#availability_statut:visible').hide();
|
||||||
}
|
|
||||||
|
|
||||||
//'last quantities' message management
|
//'last quantities' message management
|
||||||
if (!allowBuyWhenOutOfStock)
|
if (!allowBuyWhenOutOfStock)
|
||||||
{
|
{
|
||||||
if (quantityAvailable <= maxQuantityToAllowDisplayOfLastQuantityMessage)
|
if (quantityAvailable <= maxQuantityToAllowDisplayOfLastQuantityMessage)
|
||||||
$('#last_quantities').show('slow');
|
$('#last_quantities').show('slow');
|
||||||
else
|
else
|
||||||
$('#last_quantities').hide('slow');
|
$('#last_quantities').hide('slow');
|
||||||
}
|
}
|
||||||
@@ -233,28 +229,27 @@ function updateDisplay()
|
|||||||
}
|
}
|
||||||
if(stock_management == 1)
|
if(stock_management == 1)
|
||||||
$('#availability_statut:hidden').show();
|
$('#availability_statut:hidden').show();
|
||||||
|
|
||||||
//display availability date
|
if (typeof(selectedCombination['available_date']) != 'undefined' && selectedCombination['available_date']['date'].length != 0)
|
||||||
if (selectedCombination.length)
|
|
||||||
{
|
{
|
||||||
var available_date = selectedCombination['available_date'];
|
var available_date = selectedCombination['available_date']['date'];
|
||||||
tab_date = available_date.split('-');
|
var tab_date = available_date.split('-');
|
||||||
var time_available = new Date(tab_date[2], tab_date[1], tab_date[0]);
|
var time_available = new Date(tab_date[0], tab_date[1], tab_date[2]);
|
||||||
time_available.setMonth(time_available.getMonth()-1);
|
time_available.setMonth(time_available.getMonth()-1);
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
// date displayed only if time_available
|
if (now.getTime() < time_available.getTime() && $('#availability_date_value').text() != selectedCombination['available_date']['date_formatted'])
|
||||||
if (now.getTime() < time_available.getTime())
|
|
||||||
{
|
{
|
||||||
$('#availability_date_value').text(selectedCombination['available_date']);
|
$('#availability_date').fadeOut('normal', function(){
|
||||||
$('#availability_date_label').show();
|
$('#availability_date_value').text(selectedCombination['available_date']['date_formatted']);
|
||||||
$('#availability_date_value').show();
|
$(this).fadeIn();
|
||||||
}
|
});
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#availability_date_label').hide();
|
|
||||||
$('#availability_date_value').hide();
|
|
||||||
}
|
}
|
||||||
|
else if(now.getTime() < time_available.getTime())
|
||||||
|
$('#availability_date').fadeIn();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$('#availability_date').fadeOut();
|
||||||
|
|
||||||
//show the 'add to cart' button ONLY IF it's possible to buy when out of stock AND if it was previously invisible
|
//show the 'add to cart' button ONLY IF it's possible to buy when out of stock AND if it was previously invisible
|
||||||
if (allowBuyWhenOutOfStock && !selectedCombination['unavailable'] && productAvailableForOrder == 1)
|
if (allowBuyWhenOutOfStock && !selectedCombination['unavailable'] && productAvailableForOrder == 1)
|
||||||
{
|
{
|
||||||
@@ -451,15 +446,17 @@ function displayDiscounts(combination)
|
|||||||
{
|
{
|
||||||
$('#quantityDiscount tbody tr').each(function() {
|
$('#quantityDiscount tbody tr').each(function() {
|
||||||
if (($(this).attr('id') != 'quantityDiscount_0') &&
|
if (($(this).attr('id') != 'quantityDiscount_0') &&
|
||||||
($(this).attr('id') != 'quantityDiscount_'+combination) &&
|
($(this).attr('id') != 'quantityDiscount_' + combination) &&
|
||||||
($(this).attr('id') != 'noQuantityDiscount'))
|
($(this).attr('id') != 'noQuantityDiscount'))
|
||||||
$(this).fadeOut('slow');
|
$(this).fadeOut('slow');
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('#quantityDiscount_'+combination).length != 0) {
|
if ($('#quantityDiscount_' + combination).length != 0)
|
||||||
$('#quantityDiscount_'+combination).show();
|
{
|
||||||
|
$('#quantityDiscount_' + combination).show();
|
||||||
$('#noQuantityDiscount').hide();
|
$('#noQuantityDiscount').hide();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
$('#noQuantityDiscount').show();
|
$('#noQuantityDiscount').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,13 +488,13 @@ function refreshProductImages(id_product_attribute)
|
|||||||
}
|
}
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
var thumb_width = $('#thumbs_list_frame >li').width()+parseInt($('#thumbs_list_frame >li').css('marginRight'));
|
var thumb_width = $('#thumbs_list_frame >li').width() + parseInt($('#thumbs_list_frame >li').css('marginRight'));
|
||||||
$('#thumbs_list_frame').width((parseInt((thumb_width)* i) + 3) + 'px'); // Bug IE6, needs 3 pixels more ?
|
$('#thumbs_list_frame').width((parseInt((thumb_width)* i) + 3) + 'px'); // Bug IE6, needs 3 pixels more ?
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#thumbnail_' + idDefaultImage).show();
|
$('#thumbnail_' + idDefaultImage).show();
|
||||||
displayImage($('#thumbnail_'+ idDefaultImage +' a'));
|
displayImage($('#thumbnail_' + idDefaultImage + ' a'));
|
||||||
}
|
}
|
||||||
$('#thumbs_list').trigger('goto', 0);
|
$('#thumbs_list').trigger('goto', 0);
|
||||||
serialScrollFixLock('', '', '', '', 0);// SerialScroll Bug on goto 0 ?
|
serialScrollFixLock('', '', '', '', 0);// SerialScroll Bug on goto 0 ?
|
||||||
@@ -576,8 +573,7 @@ $(document).ready(function()
|
|||||||
'transitionIn' : 'elastic',
|
'transitionIn' : 'elastic',
|
||||||
'transitionOut' : 'elastic'
|
'transitionOut' : 'elastic'
|
||||||
});
|
});
|
||||||
|
original_url = window.location + '';
|
||||||
original_url = window.location+'';
|
|
||||||
first_url_check = true;
|
first_url_check = true;
|
||||||
checkUrl();
|
checkUrl();
|
||||||
initLocationChange();
|
initLocationChange();
|
||||||
@@ -589,7 +585,7 @@ function saveCustomization()
|
|||||||
$('#quantityBackup').val($('#quantity_wanted').val());
|
$('#quantityBackup').val($('#quantity_wanted').val());
|
||||||
customAction = $('#customizationForm').attr('action');
|
customAction = $('#customizationForm').attr('action');
|
||||||
$('body select[id^="group_"]').each(function() {
|
$('body select[id^="group_"]').each(function() {
|
||||||
customAction = customAction.replace(new RegExp(this.id + '=\\d+'), this.id +'='+this.value);
|
customAction = customAction.replace(new RegExp(this.id + '=\\d+'), this.id +'=' + this.value);
|
||||||
});
|
});
|
||||||
$('#customizationForm').attr('action', customAction);
|
$('#customizationForm').attr('action', customAction);
|
||||||
$('#customizationForm').submit();
|
$('#customizationForm').submit();
|
||||||
@@ -600,7 +596,7 @@ function submitPublishProduct(url, redirect, token)
|
|||||||
var id_product = $('#admin-action-product-id').val();
|
var id_product = $('#admin-action-product-id').val();
|
||||||
|
|
||||||
$.ajaxSetup({async: false});
|
$.ajaxSetup({async: false});
|
||||||
$.post(url+'/index.php', {
|
$.post(url + '/index.php', {
|
||||||
action:'publishProduct',
|
action:'publishProduct',
|
||||||
id_product: id_product,
|
id_product: id_product,
|
||||||
status: 1,
|
status: 1,
|
||||||
@@ -615,7 +611,6 @@ function submitPublishProduct(url, redirect, token)
|
|||||||
document.location.href = data;
|
document.location.href = data;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,17 +662,17 @@ function getProductAttribute()
|
|||||||
for (var i in attributesCombinations)
|
for (var i in attributesCombinations)
|
||||||
for (var a in tab_attributes)
|
for (var a in tab_attributes)
|
||||||
if (attributesCombinations[i]['id_attribute'] === tab_attributes[a])
|
if (attributesCombinations[i]['id_attribute'] === tab_attributes[a])
|
||||||
request += '/'+attributesCombinations[i]['group']+'-'+attributesCombinations[i]['attribute'];
|
request += '/'+attributesCombinations[i]['group'] + '-' + attributesCombinations[i]['attribute'];
|
||||||
request = request.replace(request.substring(0, 1), '#/');
|
request = request.replace(request.substring(0, 1), '#/');
|
||||||
url = window.location+'';
|
url = window.location + '';
|
||||||
|
|
||||||
// redirection
|
// redirection
|
||||||
if (url.indexOf('#') != -1)
|
if (url.indexOf('#') != -1)
|
||||||
url = url.substring(0, url.indexOf('#'));
|
url = url.substring(0, url.indexOf('#'));
|
||||||
|
|
||||||
// set ipa to the customization form
|
// set ipa to the customization form
|
||||||
$('#customizationForm').attr('action', $('#customizationForm').attr('action')+request)
|
$('#customizationForm').attr('action', $('#customizationForm').attr('action') + request)
|
||||||
window.location = url+request;
|
window.location = url + request;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initLocationChange(time)
|
function initLocationChange(time)
|
||||||
@@ -691,7 +686,7 @@ function checkUrl()
|
|||||||
if (original_url != window.url || first_url_check)
|
if (original_url != window.url || first_url_check)
|
||||||
{
|
{
|
||||||
first_url_check = false;
|
first_url_check = false;
|
||||||
url = window.location+'';
|
url = window.location + '';
|
||||||
// if we need to load a specific combination
|
// if we need to load a specific combination
|
||||||
if (url.indexOf('#/') != -1)
|
if (url.indexOf('#/') != -1)
|
||||||
{
|
{
|
||||||
@@ -715,17 +710,17 @@ function checkUrl()
|
|||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
// add class 'selected' to the selected color
|
// add class 'selected' to the selected color
|
||||||
$('#color_'+attributesCombinations[a]['id_attribute']).addClass('selected');
|
$('#color_' + attributesCombinations[a]['id_attribute']).addClass('selected');
|
||||||
$('#color_'+attributesCombinations[a]['id_attribute']).parent().addClass('selected');
|
$('#color_' + attributesCombinations[a]['id_attribute']).parent().addClass('selected');
|
||||||
$('input:radio[value='+attributesCombinations[a]['id_attribute']+']').attr('checked', true);
|
$('input:radio[value=' + attributesCombinations[a]['id_attribute'] + ']').attr('checked', true);
|
||||||
$('input:hidden[name=group_'+attributesCombinations[a]['id_attribute_group']+']').val(attributesCombinations[a]['id_attribute']);
|
$('input:hidden[name=group_' + attributesCombinations[a]['id_attribute_group'] + ']').val(attributesCombinations[a]['id_attribute']);
|
||||||
$('select[name=group_'+attributesCombinations[a]['id_attribute_group']+']').val(attributesCombinations[a]['id_attribute']);
|
$('select[name=group_' + attributesCombinations[a]['id_attribute_group'] + ']').val(attributesCombinations[a]['id_attribute']);
|
||||||
}
|
}
|
||||||
// find combination
|
// find combination
|
||||||
if (count >= 0)
|
if (count >= 0)
|
||||||
{
|
{
|
||||||
findCombination(false);
|
findCombination(false);
|
||||||
original_url = window.location+'';
|
original_url = window.location + '';
|
||||||
}
|
}
|
||||||
// no combination found = removing attributes from url
|
// no combination found = removing attributes from url
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -121,15 +121,19 @@ var doesntExistNoMore = '{l s='This product is no longer in stock' js=1}';
|
|||||||
var doesntExistNoMoreBut = '{l s='with those attributes but is available with others.' js=1}';
|
var doesntExistNoMoreBut = '{l s='with those attributes but is available with others.' js=1}';
|
||||||
var uploading_in_progress = '{l s='Uploading in progress, please be patient.' js=1}';
|
var uploading_in_progress = '{l s='Uploading in progress, please be patient.' js=1}';
|
||||||
var fieldRequired = '{l s='Please fill in all the required fields before saving your customization.' js=1}';
|
var fieldRequired = '{l s='Please fill in all the required fields before saving your customization.' js=1}';
|
||||||
|
|
||||||
{if isset($groups)}
|
{if isset($groups)}
|
||||||
// Combinations
|
// Combinations
|
||||||
{foreach from=$combinations key=idCombination item=combination}
|
{foreach from=$combinations key=idCombination item=combination}
|
||||||
var specific_price_combination = new Array();
|
var specific_price_combination = new Array();
|
||||||
|
var available_date = new Array();
|
||||||
specific_price_combination['reduction_percent'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 'percentage'}{$combination.specific_price.reduction*100}{else}0{/if};
|
specific_price_combination['reduction_percent'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 'percentage'}{$combination.specific_price.reduction*100}{else}0{/if};
|
||||||
specific_price_combination['reduction_price'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 'amount'}{$combination.specific_price.reduction}{else}0{/if};
|
specific_price_combination['reduction_price'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 'amount'}{$combination.specific_price.reduction}{else}0{/if};
|
||||||
specific_price_combination['price'] = {if $combination.specific_price AND $combination.specific_price.price}{$combination.specific_price.price}{else}0{/if};
|
specific_price_combination['price'] = {if $combination.specific_price AND $combination.specific_price.price}{$combination.specific_price.price}{else}0{/if};
|
||||||
specific_price_combination['reduction_type'] = '{if $combination.specific_price}{$combination.specific_price.reduction_type}{/if}';
|
specific_price_combination['reduction_type'] = '{if $combination.specific_price}{$combination.specific_price.reduction_type}{/if}';
|
||||||
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}', specific_price_combination);
|
available_date['date'] = '{$combination.available_date}';
|
||||||
|
available_date['date_formatted'] = '{dateFormat date=$combination.available_date full=false}';
|
||||||
|
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}, available_date, specific_price_combination);
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -337,13 +341,12 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
|
|||||||
<!-- availability -->
|
<!-- availability -->
|
||||||
<p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
|
<p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
|
||||||
<span id="availability_label">{l s='Availability:'}</span>
|
<span id="availability_label">{l s='Availability:'}</span>
|
||||||
<span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span>
|
<span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span>
|
||||||
{if $product->quantity <= 0 && isset($product->available_date) && $product->available_date >= $smarty.now|date_format:'%Y-%m-%d'}
|
</p>
|
||||||
<br class="clear"/><span id="availability_date_label">{l s='Availability date:'}</span>
|
<p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
|
||||||
<span id="availability_date_value">{$product->available_date}</span>
|
<span id="availability_date_label">{l s='Availability date:'}</span>
|
||||||
{/if}
|
<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- number of item in stock -->
|
<!-- number of item in stock -->
|
||||||
{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
|
{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
|
||||||
<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
|
<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
|
||||||
|
|||||||
Reference in New Issue
Block a user