| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
ShopBy Brand - brand page layout changes | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
ShopBy Brand - brand page layout changes
Hello,
I am using the ShopByBrand module for XC5. I want to change the way the brands are displayed on the "All brands" page .... I have tried decoragting the BrandsPage class, but can't get any output... What I am trying to acheive is a column based list showing juts Brand Names grouped by their inital letter, for instance A Abrand1 Abrand2 ... B Bbrand1 Bbrand2 ... etc. I have written the PHP code to output an array structure for this ... but nothing is coming out .. it relies on the getBrands function, but juts doesn't seem to be calling it ... any clues? Jan
__________________
Jan Beesley (Currently Xcart 5 Previously XCart Gold from 3.5....) |
|||||||
#2
|
|||||||||
|
|||||||||
Re: ShopBy Brand - brand page layout changes
Hi Jan,
Here are the files that render the page: 1. skins/default/en/modules/QSL/ShopByBrand/brands_page/all_brands.tpl is the template that wraps the page data into HTML. It uses the BrandsPage class to get the page data and do necessary checks/logic against it. 2. XLite\Module\QSL\ShopByBrand\View\BrandsPage is the class that implement the logic to retrieve page data and do checks against it. The "getBrands()" method uses other classes to retrieve brands from the database. The "getBrandRows()" method prepare the data and split it into chunks (rows). There are other methods used by the template (check the template for their names). From you description it looks like you are to "decorate" both the files from your module: - you need the data displayed in a single column with every group having the "letter" title, so you should change the template file - you need the data to be ordered by the brand name, so you should change the getBrands() method accordingly - you need the data to be a plain list of brands, not a table with multiple columns, so you should change the getBrandRows() method as well (or create a new method and call it from your new template instead of this one) |
|||||||||
#3
|
|||||||
|
|||||||
Re: ShopBy Brand - brand page layout changes
Thanks, would you mind looking at my code .... it doesn't cause any problems but doesn't seem to product any output!
This is my BrandsPage module: Code:
and this is the all_brands.tpl Code:
I am obviously missing something somewhere .... Thanks for your help
__________________
Jan Beesley (Currently Xcart 5 Previously XCart Gold from 3.5....) |
|||||||
#4
|
|||||||||
|
|||||||||
Re: ShopBy Brand - brand page layout changes
Code:
Please check the var/log/ directory. I believe you should find a lot of "function getBrands() is not found" errors there. Do you want to call the getBrands() method from the original class? If so, it should be "$this->getBrands()". |
|||||||||
#5
|
|||||||
|
|||||||
Re: ShopBy Brand - brand page layout changes
Thanks.
I have changed my code but am still getting empty output: Code:
If I try and call the getBrandsAlpha function directly - I still get no output. Where am I going wrong? Jan
__________________
Jan Beesley (Currently Xcart 5 Previously XCart Gold from 3.5....) |
|||||||
#6
|
|||||||||
|
|||||||||
Re: ShopBy Brand - brand page layout changes
You may try to debug your code by inserting the following code to check what values your custom methods get as parameters, and what these methods return.
Code:
The log file will be var/log/debug.log If the variable is an object, the dump may become too large, or the script may even hang. So, instead of dumping object use their methods or functions like "count()".
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#7
|
|||||||
|
|||||||
Re: ShopBy Brand - brand page layout changes
Thanks, that has been very helpful.
I realised that the getBrands() function returns an array with the brand id and not the brand name. So I now have my brands coming out in columns as required which is great ... but one question. How can I get the brand name from within my class? I need to build an array with this structure: array[initial letter](array[brand]) If I can get the brandname in my class then I can do this. I have tried using the getName function, but this doesn't seem to work (it's from a different class). You can see the layout I am trying to acheive in the post at the start of this thread. Help!
__________________
Jan Beesley (Currently Xcart 5 Previously XCart Gold from 3.5....) |
|||||||
#8
|
|||||||||
|
|||||||||
Re: ShopBy Brand - brand page layout changes
The getBrands() function is a bit tricky as it returns not an array of brand objects directly, but an array of arrays having the brand model as object with the 0 key.
So, if you want to get the brand name this should work: Code:
|
|||||||||
|
#9
|
|||||||
|
|||||||
Re: ShopBy Brand - brand page layout changes
Excellent! I have now got this working.
I do have another question relating to brands and product filters, but I will start a new thread for that. In case anyone is remotely interested, here is the final code (I put the "initial" in as a variable in the Brands array to make it easier to extract in the template): These are the relevant functions in my class: Code:
and this is the all_brands.tpl code: Code:
On to the next challenge ....
__________________
Jan Beesley (Currently Xcart 5 Previously XCart Gold from 3.5....) |
|||||||
|
|||
X-Cart forums © 2001-2020
|