| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Display manufacturer list on category page | ||||
|
|
Thread Tools | Search this Thread |
#11
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
You will need to make an array of the manufacturers unique to that category. Try something like:
In products.php: Code:
Then in the template, probably subcategories.php, you can go through that array: Code:
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold (CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module) |
|||||||||
|
#12
|
|||||||
|
|||||||
Re: Display manufacturer list on category page
Quote:
We are getting somewhere now That code display this list in array:
Thanks.
__________________
x-cart 4.4.2 Gold |
|||||||
#13
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
{if $manuf_this_cat}
<hr /> <ul> {foreach from=$manuf_this_cat key=k item=v} <li> manufacturerid:{$k}<br /> number items this cat:{$v}<br /> name: {$manufacturers.$k.manufacturer}<br /> link: <a href="manufacturers.php?manufacturerid={$k}">{$man ufacturers.$k.manufacturer}</a> </li> {/foreach} </ul> <hr /> {/if} ---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold (CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module) |
|||||||||
|
#14
|
|||||||
|
|||||||
Re: Display manufacturer list on category page
That does it
I did notice a bug tho, manufacturer name that is displayed is wrong. What I noticed is that it pulls correct masnufacturer IDs but displays wrong name. Is it in the products.php code? Thanks.
__________________
x-cart 4.4.2 Gold |
|||||||
#15
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
Take care just when coping and pasting code from the forum - it looks like the forum software put an extra blank space in $manufacturers. I should have enclosed it in code tags
---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold (CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module) |
|||||||||
#16
|
|||||||
|
|||||||
Re: Display manufacturer list on category page
Quote:
I did caught that blank space and corrected it but still manufacturer name comes out wrong. any idea? Thanks.
__________________
x-cart 4.4.2 Gold |
|||||||
#17
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
Reviewing the code I provided, it is escaping me how the id could be right and the name be off. You could have something in your cart instance that I am not considering.
You can debug it by using webmastermode and looking at the contents of the $manufacturers array and the $manuf_this_cat array and seeing where the data is wrong, then correcting the code from there. ---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold (CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module) |
|||||||||
#18
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
It looks like the original array only stores id=count with no name.
The manufacturer name is already there in $manufacturers_menu as in my earlier code example. |
|||||||||
#19
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
I was thinking that $manufacturers used the actual id as the first key of the 2 dimensional array. But I did a quick check and the first key is just a counter - so my code needs to be fixed. No time to try this - syntax may be off, but something like this should do the trick:
In products.php: Code:
Then in the template: Code:
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold (CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module) |
|||||||||
#20
|
|||||||||
|
|||||||||
Re: Display manufacturer list on category page
Now on top of a new array there's an extra query for every product. I really don't recommend doing it like this. I would just use the data that is already there.
|
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|