// small bugs in combinaitions of virtual products
This commit is contained in:
1 parent
c97b48b394
commit
cd80e68ae2
7 files changed
+57
-43
No files matched your search
@@ -34,6 +34,12 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{if $product->is_virtual}
|
||||||
|
$('#virtual_good_attributes').show();
|
||||||
|
{else}
|
||||||
|
$('#virtual_good_attributes').hide();
|
||||||
|
{/if}
|
||||||
|
|
||||||
var msg_combination_1 = '{l s='Please choose a group'}';
|
var msg_combination_1 = '{l s='Please choose a group'}';
|
||||||
var msg_combination_2 = '{l s='Please choose an attribute'}';
|
var msg_combination_2 = '{l s='Please choose an attribute'}';
|
||||||
var msg_combination_3 = '{l s='You can only add one combination per type of group'}';
|
var msg_combination_3 = '{l s='You can only add one combination per type of group'}';
|
||||||
@@ -47,30 +53,6 @@
|
|||||||
updateMvtStatus($(this).val());
|
updateMvtStatus($(this).val());
|
||||||
});
|
});
|
||||||
updateMvtStatus($(this).val());
|
updateMvtStatus($(this).val());
|
||||||
|
|
||||||
if ( $("input[name=is_virtual_file]:checked").val() == 1)
|
|
||||||
{
|
|
||||||
$("#virtual_good_attributes").show();
|
|
||||||
$("#is_virtual_file_product").show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#virtual_good_attributes").hide();
|
|
||||||
$("#is_virtual_file_product").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$("input[name=is_virtual_file]").live("change", function() {
|
|
||||||
if($(this).val() == "1")
|
|
||||||
{
|
|
||||||
$("#virtual_good_attributes").show();
|
|
||||||
$("#is_virtual_file_product").show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#virtual_good_attributes").hide();
|
|
||||||
$("#is_virtual_file_product").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -184,6 +166,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p class="block">
|
<p class="block">
|
||||||
<label for="virtual_product_expiration_date_attribute" class="t">{l s='Expiration date'}</label>
|
<label for="virtual_product_expiration_date_attribute" class="t">{l s='Expiration date'}</label>
|
||||||
|
<input type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" class="datepicker hasDatepicker" /> {l s='Format: YYYY-MM-DD'}
|
||||||
<input class="datepicker" type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
|
<input class="datepicker" type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
|
||||||
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
|
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
$('#is_virtual_good').removeAttr('checked');
|
$('#is_virtual_good').removeAttr('checked');
|
||||||
$('div.is_virtual_good').hide();
|
$('div.is_virtual_good').hide();
|
||||||
$('#is_virtual').val(0);
|
$('#is_virtual').val(0);
|
||||||
|
$("#virtual_good_attributes").hide();
|
||||||
|
|
||||||
var val = $(this).val();
|
var val = $(this).val();
|
||||||
|
|
||||||
@@ -113,9 +114,10 @@
|
|||||||
else if (val == 2)
|
else if (val == 2)
|
||||||
{
|
{
|
||||||
$('li.tab-row a[id*="VirtualProduct"]').show();
|
$('li.tab-row a[id*="VirtualProduct"]').show();
|
||||||
$('#is_virtual_good').attr('checked', true).attr('disabled', 'disabled');
|
$('#is_virtual_good').attr('checked', true);
|
||||||
$('#virtual_good').show();
|
$('#virtual_good').show();
|
||||||
$('#is_virtual').val(1);
|
$('#is_virtual').val(1);
|
||||||
|
$("#virtual_good_attributes").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,19 +38,18 @@
|
|||||||
{
|
{
|
||||||
$('#virtual_good').show();
|
$('#virtual_good').show();
|
||||||
$('#virtual_good_more').show();
|
$('#virtual_good_more').show();
|
||||||
$('#is_virtual_good').attr('disabled', 'disabled');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('.is_virtual_good').hide();
|
||||||
|
|
||||||
if ( $('input[name=is_virtual_file]:checked').val() == 1)
|
if ( $('input[name=is_virtual_file]:checked').val() == 1)
|
||||||
{
|
{
|
||||||
$('#virtual_good_more').show();
|
$('#virtual_good_more').show();
|
||||||
$('#virtual_good_attributes').show();
|
|
||||||
$('#is_virtual_file_product').show();
|
$('#is_virtual_file_product').show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#virtual_good_more').hide();
|
$('#virtual_good_more').hide();
|
||||||
$('#virtual_good_attributes').hide();
|
|
||||||
$('#is_virtual_file_product').hide();
|
$('#is_virtual_file_product').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,13 +57,11 @@
|
|||||||
if($(this).val() == '1')
|
if($(this).val() == '1')
|
||||||
{
|
{
|
||||||
$('#virtual_good_more').show();
|
$('#virtual_good_more').show();
|
||||||
$('#virtual_good_attributes').show();
|
|
||||||
$('#is_virtual_file_product').show();
|
$('#is_virtual_file_product').show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#virtual_good_more').hide();
|
$('#virtual_good_more').hide();
|
||||||
$('#virtual_good_attributes').hide();
|
|
||||||
$('#is_virtual_file_product').hide();
|
$('#is_virtual_file_product').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -76,7 +73,7 @@
|
|||||||
return (code == 13) ? false : true;
|
return (code == 13) ? false : true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function uploadFile()
|
function uploadFile()
|
||||||
{
|
{
|
||||||
$.ajaxFileUpload (
|
$.ajaxFileUpload (
|
||||||
@@ -153,7 +150,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="is_virtual_good">
|
<div class="is_virtual_good">
|
||||||
<input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" {*onclick="toggleVirtualProduct(this);"*} {if $product->is_virtual && $product->productDownload->active}checked="checked"{/if} />
|
<input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" {if $product->is_virtual && $product->productDownload->active}checked="checked"{/if} />
|
||||||
<label for="is_virtual_good" class="t bold">{l s='Is this a virtual product?'}</label>
|
<label for="is_virtual_good" class="t bold">{l s='Is this a virtual product?'}</label>
|
||||||
</div>
|
</div>
|
||||||
{* [begin] virtual product *}
|
{* [begin] virtual product *}
|
||||||
@@ -210,7 +207,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="block">
|
<p class="block">
|
||||||
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
|
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
|
||||||
<input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="{$product->productDownload->display_filename|htmlentitiesUTF8}" />
|
<input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="{$product->productDownload->display_filename|htmlentitiesUTF8}" />
|
||||||
@@ -229,7 +226,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p class="block">
|
<p class="block">
|
||||||
<label for="virtual_product_expiration_date" class="t">{l s='Expiration date'}</label>
|
<label for="virtual_product_expiration_date" class="t">{l s='Expiration date'}</label>
|
||||||
<input class="datepicker" type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="{$product->productDownload->date_expiration}" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
|
<input class="datepicker hasDatepicker" type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="{$product->productDownload->date_expiration}" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
|
||||||
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
|
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="block">
|
<p class="block">
|
||||||
|
|||||||
@@ -228,6 +228,23 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'product_download`
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
|
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the result from an id_product_attribute
|
||||||
|
*
|
||||||
|
* @param int $id_product Product the id
|
||||||
|
* @param int $id_product_attribute Attribute the id
|
||||||
|
* @return array result for this virtual product
|
||||||
|
*/
|
||||||
|
public static function getAttributeFromIdAttribute($id_product, $id_product_attribute)
|
||||||
|
{
|
||||||
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
|
SELECT *
|
||||||
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
|
WHERE `id_product` = '.(int)$id_product.'
|
||||||
|
AND `id_product_attribute` = '.(int)$id_product_attribute.'
|
||||||
|
AND `active` = 1');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the display filename from a physical filename
|
* Return the display filename from a physical filename
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
'Associations' => true,
|
'Associations' => true,
|
||||||
'Images' => false,
|
'Images' => false,
|
||||||
'Shipping' => true,
|
'Shipping' => true,
|
||||||
'Combinations' => false,
|
'Combinations' => true,
|
||||||
'Features' => false,
|
'Features' => false,
|
||||||
'Customization' => false,
|
'Customization' => false,
|
||||||
'Attachments' => false,
|
'Attachments' => false,
|
||||||
@@ -1087,9 +1087,25 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product($id_product)))
|
if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product($id_product)))
|
||||||
{
|
{
|
||||||
$combinations = $product->getAttributeCombinaisonsById($id_product_attribute, $this->context->language->id);
|
$combinations = $product->getAttributeCombinaisonsById($id_product_attribute, $this->context->language->id);
|
||||||
|
$product_download = ProductDownload::getAttributeFromIdAttribute($id_product, $id_product_attribute);
|
||||||
foreach ($combinations as $key => $combinaison)
|
foreach ($combinations as $key => $combinaison)
|
||||||
|
{
|
||||||
$combinations[$key]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
|
$combinations[$key]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
|
||||||
|
|
||||||
|
// Added fields virtual product
|
||||||
|
if (count($product_download))
|
||||||
|
{
|
||||||
|
$combinations[$key]['id_product_download'] = $product_download[0]['id_product_download'];
|
||||||
|
$combinations[$key]['display_filename'] = $product_download[0]['display_filename'];
|
||||||
|
$combinations[$key]['filename'] = $product_download[0]['filename'];
|
||||||
|
$combinations[$key]['date_expiration'] = $product_download[0]['date_expiration'];
|
||||||
|
$combinations[$key]['nb_days_accessible'] = $product_download[0]['nb_days_accessible'];
|
||||||
|
$combinations[$key]['nb_downloadable'] = $product_download[0]['nb_downloadable'];
|
||||||
|
$combinations[$key]['is_shareable'] = $product_download[0]['is_shareable'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
die(Tools::jsonEncode($combinations));
|
die(Tools::jsonEncode($combinations));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,12 +163,12 @@ function editProductAttribute(ids, token)
|
|||||||
var upc = data[0]['upc'];
|
var upc = data[0]['upc'];
|
||||||
var minimal_quantity = data[0]['minimal_quantity'];
|
var minimal_quantity = data[0]['minimal_quantity'];
|
||||||
var available_date = data[0]['available_date'];
|
var available_date = data[0]['available_date'];
|
||||||
var virtual_product_name_attribute = null;
|
var virtual_product_name_attribute = data[0]['display_filename'];
|
||||||
var virtual_product_filename_attribute = null;
|
var virtual_product_filename_attribute = data[0]['display_filename'];
|
||||||
var virtual_product_nb_downloable = null;
|
var virtual_product_nb_downloable = data[0]['nb_downloadable'];
|
||||||
var virtual_product_expiration_date_attribute = null;
|
var virtual_product_expiration_date_attribute = data[0]['date_expiration'];
|
||||||
var virtual_product_nb_days = null;
|
var virtual_product_nb_days = data[0]['nb_days_accessible'];
|
||||||
var is_shareable = null;
|
var is_shareable = data[0]['is_shareable'];
|
||||||
|
|
||||||
fillCombinaison(
|
fillCombinaison(
|
||||||
wholesale_price,
|
wholesale_price,
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ virtual_product_nb_days, is_shareable)
|
|||||||
{
|
{
|
||||||
var link = '';
|
var link = '';
|
||||||
init_elems();
|
init_elems();
|
||||||
$("#virtual_good_attributes").show();
|
|
||||||
$('#stock_mvt_attribute').show();
|
$('#stock_mvt_attribute').show();
|
||||||
$('#initial_stock_attribute').hide();
|
$('#initial_stock_attribute').hide();
|
||||||
$('#attribute_quantity').html(quantity);
|
$('#attribute_quantity').html(quantity);
|
||||||
|
|||||||
Reference in new issue
Block a user