Hi,
Just one small question. When I create a new layout where I can't find it within the website structure. I can't see it anywhere in the theme folder. Where is it stored?Additionally when I create new layout via FTP changes don't seem to take any effect. I can confirm cache is off.
Thanks.
Just one small question. When I create a new layout where I can't find it within the website structure. I can't see it anywhere in the theme folder. Where is it stored?Additionally when I create new layout via FTP changes don't seem to take any effect. I can confirm cache is off.
Thanks.
In Themes
Share this post:
Accepted Answer
Hi Theme Bullet,
The templates use a delayed output of variables some of which are pre-defined in the MVC structure for the modules as can be seen in the developers documentation.
In the first instance it is probably easiest to backup and then overwrite the existing template files so you can definitely see the results.
For example to add the variable for attributes available in the "product.tpl" to the "category.tpl" you have to first re-define the "Controller" for the category module to include it:-
path = /catalog/controller/product/category.php (line 229 approx.)
Changes to :-
This can effect all template files using the "category" module.
Then we make the necessary modifications to the public output of the "category.tpl" for the "Second" Theme in this case. This is to show the contents of a category as a list of items without the thumbnail image and include options to add to cart without needing to visit the "product.tpl" layout page. Also, the attributes for "Specification" (custom attribute) can be displayed if they exist? :-
path = /catalog/view/theme/second/template/product/category.tpl (line approx. 110-166)
Also, to show the page as a "list" view as opposed to a "grid" view by default we add some javascript to the bottom of the "category.tpl" file too :-
Hope this helps.
Regards,
Hackasacka
The templates use a delayed output of variables some of which are pre-defined in the MVC structure for the modules as can be seen in the developers documentation.
In the first instance it is probably easiest to backup and then overwrite the existing template files so you can definitely see the results.
For example to add the variable for attributes available in the "product.tpl" to the "category.tpl" you have to first re-define the "Controller" for the category module to include it:-
path = /catalog/controller/product/category.php (line 229 approx.)
$this->trigger->fire('pre.product.display', array(&$result, 'category'));
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => $result['description'],
'price' => $price,
'special' => $special,
'tax' => $tax,
'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating' => $rating,
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);
}
Changes to :-
$this->trigger->fire('pre.product.display', array(&$result, 'category'));
//Code to add attribute variable to scope
$attrs = $this->model_catalog_product->getProductAttributes($result['product_id']);
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => $result['description'],
'price' => $price,
'special' => $special,
'attrs' => $attrs, //code to add attributes to array
'tax' => $tax,
'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating' => $rating,
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);
}
This can effect all template files using the "category" module.
Then we make the necessary modifications to the public output of the "category.tpl" for the "Second" Theme in this case. This is to show the contents of a category as a list of items without the thumbnail image and include options to add to cart without needing to visit the "product.tpl" layout page. Also, the attributes for "Specification" (custom attribute) can be displayed if they exist? :-
path = /catalog/view/theme/second/template/product/category.tpl (line approx. 110-166)
<div class="row">
<?php foreach ($products as $product) { ?>
<div class="product-layout product-list col-xs-12">
<div>
<!-- <div class="image"><a href="/<?php echo $product['href']; ?>"><img src="/<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></a></div> -->
<div>
<div style="display: inline-block;">
<h3 style="display: inline-block; width: 150px;"><a href="/<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h3>
<!-- <p><?php echo $product['description']; ?></p> -->
<?php if($product['attrs']) { ?>
<p class="price" style="display: inline-block; width: 250px;">
<span class="price-new" style="display: inline-block; width: 250px;">
<?php foreach($product['attrs'] as $attr) {
if($attr['name']=='Specification') {
foreach($attr['attribute'] as $a) {
echo $a['text'] . '<br>';
}
}
}
?>
</span>
</p>
<?php } else { ?>
<p class="price" style="display: inline-block; width: 250px;">
<span class="price-new" style="display: inline-block; width: 100px;">
</span>
</p>
<?php } ?>
<?php if ($product['price']) { ?>
<p class="price" style="display: inline-block; width: 100px;">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<!-- <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span> -->
<?php } ?>
</p>
<?php } ?>
</div>
<div style="display: inline-block;">
<button type="button" on-click="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
<button type="button" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" on-click="wishlist.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-heart"></i></button>
<button type="button" data-toggle="tooltip" title="<?php echo $button_compare; ?>" on-click="compare.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-exchange"></i></button>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
Also, to show the page as a "list" view as opposed to a "grid" view by default we add some javascript to the bottom of the "category.tpl" file too :-
<!-- $(document).ready(function() {
//your code
});
-->
<s-cript>
$(document).ready(function() {
$('#content .product-layout > .clearfix').remove();
//$('#content .product-layout').attr('class', 'product-layout product-list col-xs-12');
$('#content .row > .product-layout').attr('class', 'product-layout product-list col-xs-12');
localStorage.setItem('display', 'list');
});
</script>
Hope this helps.
Regards,
Hackasacka
Responses (5)
-
Accepted Answer
-
Accepted Answer
Hi Rune
thanks for your reply.
Well, this is what we are doing here. The main issue we are facing is being able to force the site to update. We did check docs with no luck so we are working on a live organism I would say and checking the option. We did go pretty far anyway and would like to be able to see the results. Cleaning cache altogether didn't help.
So we do that manually - accordingly to docs and all is fine. Layout is recognized, we can assign it via dashboard and so on. But if we want to have better control over the file there is no changes to the output.
Perhaps I give you simple example for the sake of better explanation:
1. we created mycategorylayout.tpl file
2. we do upload it
3. we assign it to category - all is fine until now
4. We want to adjust the content - we remove some of the divs, do some changes to layout structure
5. So we reupload the file, we make sure file has right permissions and gets overrided (double checked it)
6. We refresh the category page with the custom layout assigned but no changes are visible - it shows the first layout file. From now on whatever we change it this
Foreseeing potential questions one may have:
- yes, we did clear the cache
- file was overriden
- we tried private windows, new browsers
- we did search database only to find IDs and name for the custom layout, so all regular staff
So the questions would be what we need to do for the changes to take effect? Hope that explains initial questions a tad bit better - this is what we meant where the .tpl file is stored.
And regarding documentation it would be super useful if it could be a bit more updated / expanded. -
Accepted Answer
There is no new files created this way, you're just arranging/placing modules in the already defined positions (defined in existing theme files). The data for the placements are stored into the database.
If you want to create new layouts with new files, you'll have to create the files "the hard way", as a designer (ref designers docs).
Note! Sadly the docs are a bit outdated regarding designers, so I recommend also to investigate the possibilities from files in the Second theme. -
Accepted Answer
Probably you don't I followed documentation and read it already, just to clarify.
Perhaps I should be more clear. My question applies to this part of documentation :
https://arastta.org/docs/user-manual/appearance/layouts
No matter whether I create new layout in the way it is described in the documentation or via dashboard. I don't have any control over .tpl file.
Let me elaborate. When I create new layout via dashboard, I am able to add modules and I can see the changes, but I can't find the .tpl file via FTP.
So... If I create the new layout via dashboard where exacly the new .tpl file is saved?
Summarizing it:
- when I create new layout via dashboard only there is no tpl file and changes work but cant change output cause simply there is no file anywhere
- whereas when I create new layout first and upload it through FTP to the theme folder (so stricly following documentation) then any changes I make to the structure (via code) won't take effect.
I can't go simpler Hope it's more clear now.
Thanks -
Accepted Answer
Sorry, but I probably don't understand what you're saying/asking here.
How do you create a new layout? Which choice do you do (where)?
Anyhow I think the documentation section would be a good start for you. Look at the User Manual and Designers section etc.:
https://arastta.org/docs
Your Reply
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »