- catalog/controller/module/latest.php file.
- catalog/controller/module/featured.php file.
- catalog/controller/module/bestsellers.php file.
Same steps.
Find:
Code: Select all
$results = $this->model_catalog_product->getProducts($data);
Code: Select all
$this->load->model('catalog/manufacturer');
$this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
Code: Select all
$this->data['products'][] = array(
Code: Select all
$attribute_groups = $this->model_catalog_product->getProductAttributes($result['product_id']);
$manufacturer = $this->model_catalog_manufacturer->getManufacturer($result['manufacturer_id']);
$manufacturers = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']);
Code: Select all
$this->data['products'][] = array(
Code: Select all
'attribute_groups' => $attribute_groups,
'manufacturers' => $manufacturers,
'manufacturer' => $manufacturer,
In your catalog/view/theme/<your_theme>/template/module/featured.tpl file.
In your catalog/view/theme/<your_theme>/template/module/bestsellers.tpl file.
Find each:
Code: Select all
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
Code: Select all
<div class="description">
<?php if ($product['manufacturer']) { ?>
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $product['manufacturers']; ?>"><?php echo $product['manufacturer']; ?></a><br />
<?php } ?>
</div>
<?php if ($product['attribute_groups']) { ?>
<div id="tab-attribute" class="tab-content">
<table class="attribute">
<?php foreach ($product['attribute_groups'] as $attribute_group) { ?>
<thead>
<tr>
<td colspan="2"><?php echo $attribute_group['name']; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<tr>
<td><?php echo $attribute['name']; ?></td>
<td><?php echo $attribute['text']; ?></td>
</tr>
<?php } ?>
</tbody>
<?php } ?>
</table>
</div>
<?php } ?>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
First ı want to thank you for your explanatory, clear answer.
I applied your code on 'latest'.
I'm attaching here the result as an image in latest module .
As seen on the image;
== On the image, On the left corner, Samsung Galaxy does not have any manufacturer assigned to it, so it does not display any
'Array'.
==text_manufacturer's output 'text' is to be corrected.
==Product Attributes are in a table.(I'll remove the table. )
==Product-name has to be just below the immage.
== Besides these we have to sellect only one 'group of attribute'. Not all groups and all attributes.( Let's say only Memory group on the image )or maybe only the first attribute group.
I try to replace some code to find a solution but ı do not have enough php knowledge manage it.
Waiting for your help or modifications on the code.
Thanks
Code: Select all
<div class="description">
<?php if ($product['manufacturer']) { ?>
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $product['manufacturers']; ?>"><?php echo $product['manufacturer']; ?></a><br />
<?php } ?>
</div>
Code: Select all
<div class="description">
<?php if ($product['manufacturer']) { ?>
<span><?php echo $text_manufacturer; ?></span>
<?php foreach ($product['manufacturer'] as $manufacturer) { ?>
<a href="<?php echo $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']); ?>"><?php echo html_entity_decode($manufacturer['name'], ENT_QUOTES, 'UTF-8'); ?></a><br />
<?php } ?>
<?php } ?>
</div>
add above the ?>:
Code: Select all
$_['text_manufacturer'] = 'Manufacturer: ';
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I made a small change on your code. So, one of two questions is solved. Attributes from a sellected attribute_group are produced:
Code: Select all
<?php if ($product['attribute_groups']) { ?>
<div id="tab-attribute" class="tab-content">
<?php foreach ($product['attribute_groups'] as $attribute_group) { ?>
<?php if ($attribute_group['name']=='Memory') { ?>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<?php echo $attribute['name']; ?>
<?php echo ":"; ?>
<?php echo $attribute['text']; ?>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
But displaying manufacturer_name (linked to it's file) is not solved.
I'm waiting for some help for this issue.
Thanks for your effort and guidance for the solved part.
Best wishes
I'm not sure what you mean by manufacturer_name linked to it's file ... could you elaborate that a little ?But displaying manufacturer_name (linked to it's file) is not solved.
As for the manufacturer_name, it would rather be: manufacturer['name'] from the loop.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
There is a misunderstanding about 'forget it'. I did not mean to forget the questions on this post. Anyway the remaining question about 'manufacturer name' or 'brand' under all thumbnails is waiting an answer from our experienced friends like you.
Best Regards
Let's not close this post before getting any suitable explanation for the unsolved part of the issue : "putting the manufacturer name below every thumbnail in latest, featured, bestsellers or/and similar modules".
The solutions from straightlight are very close to find the correct answer. But my php knowledge is not capabil to develop it. Here ı want to give some additional info about the final situation. I made some small changes on the straightlight's codes and this image demonstrates the final output : On the image you see the links produced with this code.
Below is 'latest.tpl' the compleat file where ı added straightlight's codes into the file :
Code: Select all
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div class="box-product">
<?php foreach ($products as $product) { ?>
<div>
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>">
<img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<?php } ?>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<!-- BELOW IS CODE FOR MANUFACTURER AND A GROUP OF ATTRiBUTES (Attribute group= 'Memory') -->
<?php if ($product['manufacturer']) { ?>
<div class="description">
<?php foreach ($product['manufacturer'] as $manufacturer) { ?>
<a href="<?php echo $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']); ?>">
<?php echo html_entity_decode($manufacturer['name'], ENT_QUOTES, 'UTF-8'); ?>
</a><br />
<?php } ?>
<?php } ?>
</div>
<!----------THıS PART BELOW FOR ATTRıBUTE GROUP------------->
<?php if ($product['attribute_groups']) { ?>
<div id="tab-attribute" class="tab-content">
<?php foreach ($product['attribute_groups'] as $attribute_group) { ?>
<?php if ($attribute_group['name']=='Memory') { ?>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<?php echo $attribute['name']; ?>
<?php echo ":"; ?>
<?php echo $attribute['text']; ?>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<!-- ABOVE YOU FıND CODE FOR MANUFACTURER AND A GROUP OF ATTRiBUTES (Attribute group=Memory') -->
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new">
<?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div>
</div>
<?php } ?>
</div>
</div>
</div>
Now please some help for the final solution
Thanks
Code: Select all
<div class="description">
<?php if ($product['manufacturer']) { ?>
<span><?php echo $text_manufacturer; ?></span>
<?php foreach ($product['manufacturer'] as $manufacturer) { ?>
<a href="<?php echo $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']); ?>"><?php echo html_entity_decode($manufacturer['name'], ENT_QUOTES, 'UTF-8'); ?></a><br />
<?php } ?>
<?php } ?>
</div>
Code: Select all
<div class="description">
<?php if ($product['manufacturer']) { ?>
<span><?php echo $text_manufacturer; ?></span>
<a href="<?php echo $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product['manufacturer']['manufacturer_id']); ?>"><?php echo html_entity_decode($product['manufacturer']['name'], ENT_QUOTES, 'UTF-8'); ?></a><br />
<?php } ?>
</div>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 3 guests