// fix bug with virtual product
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9325 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -479,6 +479,9 @@ class AdminProducts extends AdminTab
|
|||||||
{
|
{
|
||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$is_virtual = (int)Tools::getValue('is_virtual');
|
||||||
|
|
||||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||||
{
|
{
|
||||||
if (!isset($_POST['attribute_price']) || $_POST['attribute_price'] == null)
|
if (!isset($_POST['attribute_price']) || $_POST['attribute_price'] == null)
|
||||||
@@ -574,7 +577,11 @@ class AdminProducts extends AdminTab
|
|||||||
if (!sizeof($this->_errors))
|
if (!sizeof($this->_errors))
|
||||||
{
|
{
|
||||||
if (!$product->cache_default_attribute)
|
if (!$product->cache_default_attribute)
|
||||||
Product::updateDefaultAttribute($product->id);
|
Product::updateDefaultAttribute($product->id);
|
||||||
|
|
||||||
|
if (!empty($is_virtual))
|
||||||
|
Product::updateIsVirtual($product->id);
|
||||||
|
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=3&token='.($token ? $token : $this->token));
|
Tools::redirectAdmin(self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=3&token='.($token ? $token : $this->token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -926,8 +933,8 @@ class AdminProducts extends AdminTab
|
|||||||
@unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$image->id_product.'.jpg');
|
@unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$image->id_product.'.jpg');
|
||||||
die(true);
|
die(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $price, $from_quantity, $reduction, $reduction_type, $from, $to)
|
protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $price, $from_quantity, $reduction, $reduction_type, $from, $to)
|
||||||
{
|
{
|
||||||
if (!Validate::isUnsignedId($id_shop) || !Validate::isUnsignedId($id_currency) || !Validate::isUnsignedId($id_country) || !Validate::isUnsignedId($id_group))
|
if (!Validate::isUnsignedId($id_shop) || !Validate::isUnsignedId($id_currency) || !Validate::isUnsignedId($id_country) || !Validate::isUnsignedId($id_group))
|
||||||
@@ -1072,7 +1079,7 @@ class AdminProducts extends AdminTab
|
|||||||
$saveShort = $_POST['description_short'];
|
$saveShort = $_POST['description_short'];
|
||||||
$_POST['description_short'] = strip_tags($_POST['description_short']);
|
$_POST['description_short'] = strip_tags($_POST['description_short']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check description short size without html */
|
/* Check description short size without html */
|
||||||
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
|
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
|
||||||
if ($limit <= 0) $limit = 400;
|
if ($limit <= 0) $limit = 400;
|
||||||
@@ -2331,20 +2338,20 @@ class AdminProducts extends AdminTab
|
|||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(!$productDownload->id OR !$productDownload->active)
|
if(!$productDownload->id || !$productDownload->active)
|
||||||
$hidden = 'style="display:none;"';
|
$hidden = 'style="display:none;"';
|
||||||
|
|
||||||
$cache_default_attribute = (int) $this->getFieldValue($obj, 'cache_default_attribute');
|
$cache_default_attribute = (int)$this->getFieldValue($obj, 'cache_default_attribute');
|
||||||
$is_virtual = (int) $this->getFieldValue($obj, 'is_virtual');
|
$is_virtual = (int)$this->getFieldValue($obj, 'is_virtual');
|
||||||
|
|
||||||
if($is_virtual && $productDownload->active)
|
if($is_virtual && $productDownload->active)
|
||||||
$check = 'checked="checked"';
|
$check = 'checked="checked"';
|
||||||
|
|
||||||
if($is_virtual)
|
if($productDownload->id)
|
||||||
$virtual = 1;
|
$virtual = 1;
|
||||||
else
|
else
|
||||||
$virtual = 0;
|
$virtual = 0;
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="tab-page" id="step1">
|
<div class="tab-page" id="step1">
|
||||||
<h4 class="tab">1. '.$this->l('Info.').'</h4>
|
<h4 class="tab">1. '.$this->l('Info.').'</h4>
|
||||||
@@ -2659,8 +2666,8 @@ class AdminProducts extends AdminTab
|
|||||||
var newLabel = \''.$this->l('New label').'\';
|
var newLabel = \''.$this->l('New label').'\';
|
||||||
var choose_language = \''.$this->l('Choose language:').'\';
|
var choose_language = \''.$this->l('Choose language:').'\';
|
||||||
var required = \''.$this->l('required').'\';
|
var required = \''.$this->l('required').'\';
|
||||||
var customizationUploadableFileNumber = '.(int) $this->getFieldValue($obj, 'uploadable_files').';
|
var customizationUploadableFileNumber = '.(int)$this->getFieldValue($obj, 'uploadable_files').';
|
||||||
var customizationTextFieldNumber = '.(int) $this->getFieldValue($obj, 'text_fields').';
|
var customizationTextFieldNumber = '.(int)$this->getFieldValue($obj, 'text_fields').';
|
||||||
var uploadableFileLabel = 0;
|
var uploadableFileLabel = 0;
|
||||||
var textFieldLabel = 0;
|
var textFieldLabel = 0;
|
||||||
</script>
|
</script>
|
||||||
@@ -2673,10 +2680,9 @@ class AdminProducts extends AdminTab
|
|||||||
<input type="hidden" id="is_virtual" name="is_virtual" value="'.$virtual.'" />
|
<input type="hidden" id="is_virtual" name="is_virtual" value="'.$virtual.'" />
|
||||||
<br/>'.$this->l('Does this product has an associated file ?').'<br/>';
|
<br/>'.$this->l('Does this product has an associated file ?').'<br/>';
|
||||||
|
|
||||||
// todo gérer le is_virtual avec la valeur du produit
|
|
||||||
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$productDownload->filename;
|
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$productDownload->filename;
|
||||||
|
|
||||||
if ($productDownload->id && !empty($cache_default_attribute) && !empty($productDownload->display_filename))
|
if ($productDownload->id && !empty($cache_default_attribute) || !empty($productDownload->display_filename))
|
||||||
{
|
{
|
||||||
$check_yes = 'checked="checked"';
|
$check_yes = 'checked="checked"';
|
||||||
$check_no = '';
|
$check_no = '';
|
||||||
@@ -4540,4 +4546,4 @@ class AdminProducts extends AdminTab
|
|||||||
|
|
||||||
$this->displayErrors();
|
$this->displayErrors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -572,6 +572,11 @@ class ProductCore extends ObjectModel
|
|||||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_default_attribute = '.(int)$id_product_attribute.' WHERE id_product = '.(int)$id_product.' LIMIT 1');
|
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_default_attribute = '.(int)$id_product_attribute.' WHERE id_product = '.(int)$id_product.' LIMIT 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function updateIsVirtual($id_product)
|
||||||
|
{
|
||||||
|
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET is_virtual = 1 WHERE id_product = '.(int)$id_product.' LIMIT 1');
|
||||||
|
}
|
||||||
|
|
||||||
public function validateFieldsLang($die = true, $errorReturn = false)
|
public function validateFieldsLang($die = true, $errorReturn = false)
|
||||||
{
|
{
|
||||||
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
|
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ virtual_product_nb_days, is_shareable)
|
|||||||
link = $("#make_downloadable_product_attribute").attr('href');
|
link = $("#make_downloadable_product_attribute").attr('href');
|
||||||
$("#make_downloadable_product_attribute").attr('href', link+"&id_product_attribute="+id_product_attribute);
|
$("#make_downloadable_product_attribute").attr('href', link+"&id_product_attribute="+id_product_attribute);
|
||||||
|
|
||||||
|
$("#virtual_product_filename_attribute").val(virtual_product_filename_attribute);
|
||||||
|
console.log(virtual_product_filename_attribute);
|
||||||
|
console.log("ok");
|
||||||
|
console.log($("#virtual_product_filename_attribute").val());
|
||||||
|
|
||||||
|
|
||||||
/* Reset all combination images */
|
/* Reset all combination images */
|
||||||
combinationImages = $('#id_image_attr').find("input[id^=id_image_attr_]");
|
combinationImages = $('#id_image_attr').find("input[id^=id_image_attr_]");
|
||||||
combinationImages.each(function() {
|
combinationImages.each(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user