Sales issue fixed in grouped as well as bundle
This commit is contained in:
parent
8c7ad53776
commit
6a1a96ca59
|
|
@ -278,7 +278,7 @@ class Bundle extends AbstractType
|
|||
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (in_array($option->type, ['multiselect', 'checkbox'])) {
|
||||
if (! isset($optionPrices[$option->id][0])) {
|
||||
$optionPrices[$option->id][0] = 0;
|
||||
|
|
@ -315,7 +315,7 @@ class Bundle extends AbstractType
|
|||
if (! $bundleOptionProduct->product->getTypeInstance()->isSaleable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (in_array($option->type, ['multiselect', 'checkbox'])) {
|
||||
if (! isset($optionPrices[$option->id][0])) {
|
||||
$optionPrices[$option->id][0] = 0;
|
||||
|
|
@ -381,6 +381,25 @@ class Bundle extends AbstractType
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bundle product special price
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function checkBundleProductHaveSpecialPrice()
|
||||
{
|
||||
$haveSpecialPrice = false;
|
||||
foreach ($this->product->bundle_options as $option) {
|
||||
foreach ($option->bundle_option_products as $index => $bundleOptionProduct) {
|
||||
if ($bundleOptionProduct->product->getTypeInstance()->haveSpecialPrice()) {
|
||||
$haveSpecialPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $haveSpecialPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product minimal price
|
||||
*
|
||||
|
|
@ -390,7 +409,12 @@ class Bundle extends AbstractType
|
|||
{
|
||||
$prices = $this->getProductPrices();
|
||||
|
||||
$priceHtml = '<div class="price-from">';
|
||||
$priceHtml = '';
|
||||
|
||||
if ($this->checkBundleProductHaveSpecialPrice())
|
||||
$priceHtml .= '<div class="sticker sale">' . trans('shop::app.products.sale') . '</div>';
|
||||
|
||||
$priceHtml .= '<div class="price-from">';
|
||||
|
||||
if ($prices['from']['regular_price']['price'] != $prices['from']['final_price']['price']) {
|
||||
$priceHtml .= '<span class="regular-price">' . $prices['from']['regular_price']['formated_price'] . '</span>'
|
||||
|
|
|
|||
|
|
@ -139,6 +139,23 @@ class Grouped extends AbstractType
|
|||
return min($minPrices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group product special price
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function checkGroupProductHaveSpecialPrice()
|
||||
{
|
||||
$haveSpecialPrice = false;
|
||||
foreach ($this->product->grouped_products as $groupOptionProduct) {
|
||||
if ($groupOptionProduct->associated_product->getTypeInstance()->haveSpecialPrice()) {
|
||||
$haveSpecialPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $haveSpecialPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product minimal price
|
||||
*
|
||||
|
|
@ -146,9 +163,16 @@ class Grouped extends AbstractType
|
|||
*/
|
||||
public function getPriceHtml()
|
||||
{
|
||||
return '<span class="price-label">' . trans('shop::app.products.starting-at') . '</span>'
|
||||
. ' '
|
||||
. '<span class="final-price">' . core()->currency($this->getMinimalPrice()) . '</span>';
|
||||
$html = '';
|
||||
|
||||
if ($this->checkGroupProductHaveSpecialPrice())
|
||||
$html .= '<div class="sticker sale">' . trans('shop::app.products.sale') . '</div>';
|
||||
|
||||
$html .= '<span class="price-label">' . trans('shop::app.products.starting-at') . '</span>'
|
||||
. ' '
|
||||
. '<span class="final-price">' . core()->currency($this->getMinimalPrice()) . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue