Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

Replace all overview 02 with overview 01 #781

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/Hanzo/Bundle/ProductBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public function viewAction($product_id)
);
}

// If there are any references to this image,
// Prepend an overview 01 image of the current product to the array using array_unshift.
foreach ($images_references as $image_id => &$references) {
// If there are any references to this image,
// Add an overview of the current product at the top of the array.
if (count($references['references']) > 0) {
array_unshift($references['references'], array(
'title' => $product->getSku(),
Expand All @@ -187,6 +187,15 @@ public function viewAction($product_id)
}
}

// Replace all overview_02 with 01
foreach ($images_references as $image_id => &$references) {
foreach ($references['references'] as &$image) {
if (strpos($image['image'],'overview_02') !== false) {
$image['image'] = str_replace('overview_02', 'overview_01', $image['image']);
}
}
}

$translation_key = 'description.' . Tools::stripText($product->getSku(), '_', false);

$find = '~(background|src)="(../|/)~';
Expand All @@ -199,7 +208,7 @@ public function viewAction($product_id)
$result = ProductsWashingInstructionsQuery::create()
->filterByLocale($hanzo->get('core.locale'))
->findOneByCode($product->getWashing())
;
;

// As seo text is related to a product style we have to look at the first product id
// Currently the SEO text import/export duplicates the meta info to all varients
Expand Down Expand Up @@ -233,7 +242,7 @@ public function viewAction($product_id)
'colors' => $colors,
'all_colors' => $all_colors,
'sizes' => $sizes,
'images_references' => $images_references,
// 'images_references' => $images_references,
'has_video' => (bool) $product->getHasVideo(),
);

Expand All @@ -242,8 +251,8 @@ public function viewAction($product_id)
$prices = ProductsDomainsPricesPeer::getProductsPrices(array($data['id']));
$data['prices'] = array_shift($prices);

$images_references = $data['images_references'];
unset($data['images_references']);
// $images_references = $data['images_references'];
// unset($data['images_references']);

$this->get('twig')->addGlobal('page_type', 'product-'.$data['id']);
$this->get('twig')->addGlobal('body_classes', 'body-product product-'.$data['id']);
Expand Down