News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Default Product Details Page - category specific templates not working

Started by mark R, January 18, 2012, 22:50:43 PM

Previous topic - Next topic

mark R

Hi All,

With vm2 am i able to have different Product views for different categories.

ie
Category A - Default product style (flypage) - default.php
Category B - Different product style (flypage) - new.php

It looks like it is possible with the settings but it doesnt appear to work.??

i have set the defaults in the shop/template configuration and then put the different template in the category setup but it doesnt do any thing?

Many thanks
Seek and ye shall find.........
4 VM sites and counting

irchik15


jenkinhill

Make a local copy the original view file for category ( joomla_root/components/com_virtuemart/views/category/tmpl/default.php ) and edit it as you wish in a good plain text editor. Save it  as a different filename, eg editedcat.php  Then make a new directory under your Joomla template html directory for com_virtuemart/category - so in this case it would be
joomla_root/templates/yourjoomlatemplate/html/com_virtuemart/category/  Then ftp your edied file into that new directory.

Then in the VirtueMart backend, open the category with which you intend to use the new layout, and for Details / Category Browse Page click in the box which by default says No override and select your new template name (editedcat), save and then once refreshed, the new cat template should be used in the frontend for that category.

http://forum.virtuemart.net/index.php?topic=90935.0
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

irchik15

jenkinhill, thanks! but it works for Category Browse Page not for Product Details Page.. when i do the same for joomla_root/templates/yourjoomlatemplate/html/com_virtuemart/productdetails/ - nothing works.. but if I apply my new template in main Configuration - it is working

randomdev

Having the same problem here. Have selected it under category but doesnt appear to be applying on the front end?

Thomas Ahrnberg

We have the same problem...it doesn't seem to have any effect when trying to choose a productdetail template from category...any suggestions for a solution ?

randomdev

Disabling SEF seemed to make it work for me, but is not much of a solution.


randomdev

This is EXACTLY the kind of thing that I hate about virtuemart. Known problems from old version that still seem to have no fix and no answers from the Devs that I spend hours trying to fix myself.

Well here is my solution:
components\com_virtuemart\views\productdetails\view.html.php Around Line 321 change
shopFunctionsF::setVmTemplate($this, $category->category_template, $product->product_template, $category->category_layout, $product->layout);
to
shopFunctionsF::setVmTemplate($this, $category->category_template, $product->product_template, $category->category_product_layout, $product->layout);

Obviously a typo or something, but that didnt fix it outright.
Next
components\com_virtuemart\helpers\shopfunctionsf.php around line 342 change
if(!empty($catLayout) && empty($prodLayout)){
to
if(!empty($catLayout) && $prodLayout == 0) {

and in the same file around line 355 change
if(!empty($prodLayout)){
to
if(!empty($prodLayout) && $prodLayout != 'default'){

For me prodLayout was never empty but returned 0 when it was not set.
Also the default prodlayout was overriding a category layout that was set so I added the check for default.

This probably isnt perfect but it works for me with SEF enabled and vm 2.0.14.

Mediart

NICE WORK randomdev!!!

This kinda worked for me. My data structure did not quite function the same so I just took out the "get template from proudct" function and let it revert back to the category. SHWEEE. Now just to rember this for next update. I really hope that the fix is applied in the next update so I can just allow it to overwrite my little change. (fingers crossed)

Milbo

Quote from: randomdev on November 22, 2012, 06:30:21 AM
This is EXACTLY the kind of thing that I hate about virtuemart. Known problems from old version that still seem to have no fix and no answers from the Devs that I spend hours trying to fix myself.

and this EXACTLY shows that you do not understand how an opensource project works.
First a developer answered, his name is randomdev. Second it is not the duty of the core team to fix bugs, The core team has not duty, no one of us get payed by you or any other who wrote into this thread.

Instead of being part of the whole thing and just saying, He guys, finally I found an answer, point the core team on this thread, so that they will add it, the first I read is " I hate about virtuemart". Come on, if you dont want to be part of it, okey.

And you should also consider how much we do. I cannot fix all bugs, develop the core, read the english forum, the other forums, twitter, facebook, answer emails ah yes and somehow I must make a living, sell products, service, work for my money.  It is just a pitty.  oha I a have also a familiy with 2 children. Thank you that you use the software I put in 3 years of my live with 50 hour per week. Thank you that you put something back which is compared to what I did not even one ten thousandth.

So and now I add your fix, thanks.

Additionally to that Mr Randomdev. Look at the Thread date. Look this thread was not visited for more than 6 months. If you want to invest the time, you will see that in the svn logs it is written down that we worked on this part.

It is really unbelievable. If someone is walking slow because he is bearing 100 kg. It is clear to see that he is not able to bear the 100kg alone, right. Yes go to overstrained person, tell him that you hate it that he is going so slow, then take 10 gramms of his weight and feel better.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

Quote from: randomdev on November 22, 2012, 06:30:21 AM

components\com_virtuemart\helpers\shopfunctionsf.php around line 342 change
if(!empty($catLayout) && empty($prodLayout)){
to
if(!empty($catLayout) && $prodLayout == 0) {

But I do not understand this change.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

randomdev

Quote from: Milbo on December 14, 2012, 10:50:50 AM
Quote from: randomdev on November 22, 2012, 06:30:21 AM

components\com_virtuemart\helpers\shopfunctionsf.php around line 342 change
if(!empty($catLayout) && empty($prodLayout)){
to
if(!empty($catLayout) && $prodLayout == 0) {

But I do not understand this change.

It is probably unneccesary, for some reason I thought empty was not returning true when $prodLayout was 0 (empty should return true for 0).

I know you and the devs all work very hard to make virtuemart what it is and I thank you all for that.
However you must understand it is very frustrating as a user with basic coding experience to try to fix problems when time is limited (especially ones that have been mentioned a number of times with no solution).
If I have to spend many hours trying to debug problems it costs more than purchasing a package that has few problems.

Would it be worth charging for a pro version of virtuemart or a support package if it would help get some more people to help provide support?