Skip to content

Commit

Permalink
Merge branch '1.6' of github.com:PrestaShop/PrestaShop into 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Sacha Froment committed Oct 29, 2014
2 parents 7803a43 + e1b8b74 commit 8421397
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_date_attribute" type="default"}</span></div>
<label class="control-label col-lg-2" for="available_date_attribute">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='If this product is out of stock, you can indicate when the product will be available again.'}">
{l s='Available date'}
{l s='Availability date'}
</span>
</label>
<div class="col-lg-9">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_date" type="default"}</span></div>
<label class="control-label col-lg-2" for="available_date">
{l s='Available date:'}
{l s='Availability date:'}
</label>
<div class="col-lg-9">
<div class="input-group fixed-width-md">
Expand Down
4 changes: 2 additions & 2 deletions classes/ImageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public static function resize($src_file, $dst_file, $dst_width = null, $dst_heig
switch ($exif['Orientation'])
{
case 3:
$src_width = $tmp_height;
$src_height = $tmp_width;
$src_width = $tmp_width;
$src_height = $tmp_height;
$src_image = imagerotate($src_image, 180, 0);
break;

Expand Down
45 changes: 24 additions & 21 deletions controllers/admin/AdminImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function __construct()
'minimal_quantity' => array('label' => $this->l('Minimal quantity')),
'weight' => array('label' => $this->l('Impact on weight')),
'default_on' => array('label' => $this->l('Default (0 = No, 1 = Yes)')),
'available_date' => array('label' => $this->l('Combination available date')),
'available_date' => array('label' => $this->l('Combination availability date')),
'image_position' => array(
'label' => $this->l('Choose among product images by position (1,2,3...)')
),
Expand Down Expand Up @@ -257,7 +257,7 @@ public function __construct()
'available_now' => array('label' => $this->l('Text when in stock')),
'available_later' => array('label' => $this->l('Text when backorder allowed')),
'available_for_order' => array('label' => $this->l('Available for order (0 = No, 1 = Yes)')),
'available_date' => array('label' => $this->l('Product available date')),
'available_date' => array('label' => $this->l('Product availability date')),
'date_add' => array('label' => $this->l('Product creation date')),
'show_price' => array('label' => $this->l('Show price (0 = No, 1 = Yes)')),
'image' => array('label' => $this->l('Image URLs (x,y,z...)')),
Expand Down Expand Up @@ -2264,33 +2264,36 @@ public function attributeImport()
StockAvailable::setProductDependsOnStock($product->id, $info['depends_on_stock'], null, $id_product_attribute);

// This code allows us to set qty and disable depends on stock
if (isset($info['quantity']) && $info['depends_on_stock'] == 0)
if (isset($info['quantity']) && (int)$info['quantity'])
{
if (Shop::isFeatureActive())
foreach ($shops as $shop)
StockAvailable::setQuantity((int)$product->id, $id_product_attribute, (int)$info['quantity'], (int)$shop);
// if depends on stock and quantity, add quantity to stock
if ($info['depends_on_stock'] == 1)
{
$stock_manager = StockManagerFactory::getManager();
$price = str_replace(',', '.', $info['wholesale_price']);
if ($price == 0)
$price = 0.000001;
$price = round(floatval($price), 6);
$warehouse = new Warehouse($info['warehouse']);
if ($stock_manager->addProduct((int)$product->id, $id_product_attribute, $warehouse, (int)$info['quantity'], 1, $price, true))
StockAvailable::synchronize((int)$product->id);
}
else
StockAvailable::setQuantity((int)$product->id, $id_product_attribute, (int)$info['quantity'], $this->context->shop->id);
}
// elseif enable depends on stock and quantity, add quantity to stock
elseif (isset($info['quantity']) && $info['depends_on_stock'] == 1)
{
// add stock
$stock_manager = StockManagerFactory::getManager();
$price = str_replace(',', '.', $info['wholesale_price']);
if ($price == 0)
$price = 0.000001;
$price = round(floatval($price), 6);
$warehouse = new Warehouse($info['warehouse']);
if ($stock_manager->addProduct((int)$product->id, $id_product_attribute, $warehouse, (int)$info['quantity'], 1, $price, true))
StockAvailable::synchronize((int)$product->id);
{
if (Shop::isFeatureActive())
foreach ($id_shop_list as $shop)
StockAvailable::setQuantity((int)$product->id, $id_product_attribute, (int)$info['quantity'], (int)$shop);
else
StockAvailable::setQuantity((int)$product->id, $id_product_attribute, (int)$info['quantity'], $this->context->shop->id);
}

}
}
// if not depends_on_stock set, use normal qty
else
{
if (Shop::isFeatureActive())
foreach ($shops as $shop)
foreach ($id_shop_list as $shop)
StockAvailable::setQuantity((int)$product->id, $id_product_attribute, (int)$info['quantity'], (int)$shop);
else
StockAvailable::setQuantity((int)$product->id, $id_product_attribute, (int)$info['quantity'], $this->context->shop->id);
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/ParentOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ protected function _assignSummaryInformations()
$product['id_product'],
!Product::getTaxCalculationMethod(),
$product['id_product_attribute'],
2,
_PS_PRICE_COMPUTE_PRECISION_,
null,
false,
false,
Expand Down
2 changes: 1 addition & 1 deletion modules/dashgoals

0 comments on commit 8421397

Please sign in to comment.