// #PSFV-299
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12159 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -36,8 +36,10 @@
|
||||
{if !$product->hasAttributes()}
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="">
|
||||
<tr>
|
||||
<th>{$product->name}</th>
|
||||
{if !empty($product->reference)}<th width="150">{l s='Ref:'} {$product->reference}</th>{/if}
|
||||
<th width="150">{l s='Name:'}{$product->name}</th>
|
||||
{if !empty($product->product_supplier_reference)}<th width="280">{l s='Supplier Reference:'} {$product->product_supplier_reference}</th>{/if}
|
||||
{if !empty($product->product_supplier_price_te)}<th width="280">{l s='Wholesale price:'} {$product->product_supplier_price_te}</th>{/if}
|
||||
{if !empty($product->reference)}<th width="150">{l s='Reference:'} {$product->reference}</th>{/if}
|
||||
{if !empty($product->ean13)}<th width="120">{l s='EAN13:'} {$product->ean13}</th>{/if}
|
||||
{if !empty($product->upc)}<th width="120">{l s='UPC:'} {$product->upc}</th>{/if}
|
||||
{if $stock_management}<th class="right" width="150">{l s='Available Quantity:'} {$product->quantity}</th>{/if}
|
||||
@@ -48,13 +50,17 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:100%;">
|
||||
<colgroup>
|
||||
<col></col>
|
||||
<col width="190"></col>
|
||||
<col width="190"></col>
|
||||
<col width="80"></col>
|
||||
<col width="80"></col>
|
||||
<col width="80"></col>
|
||||
<col width="80"></col>
|
||||
<col width="50"></col>
|
||||
<col width="130"></col>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<th style="height:40px;">{l s='Attribute name'}</th>
|
||||
<th>{l s='Supplier Reference'}</th>
|
||||
<th >{l s='Wholesale price'}</th>
|
||||
<th>{l s='Reference'}</th>
|
||||
<th>{l s='EAN13'}</th>
|
||||
<th>{l s='UPC'}</th>
|
||||
@@ -63,6 +69,8 @@
|
||||
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
||||
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
||||
<td>{$product_attribute.attributes}</td>
|
||||
<td>{$product_attribute.product_supplier_reference}</td>
|
||||
<td>{$product_attribute.product_supplier_price_te}</td>
|
||||
<td>{$product_attribute.reference}</td>
|
||||
<td>{$product_attribute.ean13}</td>
|
||||
<td>{$product_attribute.upc}</td>
|
||||
|
||||
+26
-2
@@ -288,7 +288,8 @@ class SupplierCore extends ObjectModel
|
||||
public function getProductsLite($id_lang)
|
||||
{
|
||||
$sql = '
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
SELECT p.`id_product`,
|
||||
pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
@@ -300,7 +301,8 @@ class SupplierCore extends ObjectModel
|
||||
)
|
||||
GROUP BY p.`id_product`';
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -328,5 +330,27 @@ class SupplierCore extends ObjectModel
|
||||
if (parent::delete())
|
||||
return $this->deleteImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets product informations
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param int $id_supplier
|
||||
* @param int $id_product
|
||||
* @param int $id_product_attribute
|
||||
* @return array
|
||||
*/
|
||||
public static function getProductInformationsBySupplier($id_supplier, $id_product, $id_product_attribute = 0)
|
||||
{
|
||||
$query = new DbQuery();
|
||||
$query->select('product_supplier_reference, product_supplier_price_te, id_currency');
|
||||
$query->from('product_supplier');
|
||||
$query->where('id_supplier = '.(int)$id_supplier);
|
||||
$query->where('id_product = '.(int)$id_product);
|
||||
$query->where('id_product_attribute = '.(int)$id_product_attribute);
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
return $res[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,6 +261,11 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
$combinaisons = $products[$i]->getAttributeCombinaisons($this->context->language->id);
|
||||
foreach ($combinaisons as $k => $combinaison)
|
||||
{
|
||||
$comb_infos = Supplier::getProductInformationsBySupplier($this->object->id,
|
||||
$products[$i]->id,
|
||||
$combinaison['id_product_attribute']);
|
||||
$comb_array[$combinaison['id_product_attribute']]['product_supplier_reference'] = $comb_infos['product_supplier_reference'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['product_supplier_price_te'] = Tools::displayPrice($comb_infos['product_supplier_price_te'], new Currency($comb_infos['id_currency']));
|
||||
$comb_array[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
|
||||
@@ -284,6 +289,14 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
isset($comb_array) ? $products[$i]->combinaison = $comb_array : '';
|
||||
unset($comb_array);
|
||||
}
|
||||
else
|
||||
{
|
||||
$product_infos = Supplier::getProductInformationsBySupplier($this->object->id,
|
||||
$products[$i]->id,
|
||||
0);
|
||||
$products[$i]->product_supplier_reference = $product_infos['product_supplier_reference'];
|
||||
$products[$i]->product_supplier_price_te = Tools::displayPrice($product_infos['product_supplier_price_te'], new Currency($product_infos['id_currency']));
|
||||
}
|
||||
}
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
|
||||
Reference in New Issue
Block a user