Virtuemart Product Description Problem

GK User
Tue May 14, 2013 5:20 pm
Dear Gavick,

I have a problem with Virtuemart Product Description and can't get it resolved. This one is probably outside of your support. However, I'd like to see if you could advice something or some other users can advice something. Here's what I am looking for:

I need to implement the following functionality:

I need to have multiple descriptions for the same product and display the descriptions individually based on what user clicks on. Consider the following example:
    Link 1
    Link 2
    Link 3
    Product 1
    Description 1
    Description 2
    Description 3

When user clicks on Link 1, I need to display Description 1 for Product 1;
When user clicks on Link 2, I need to display Description 2 for Product 1;
When user clicks on Link 3, I need to display Description 3 for Product 1.


I am assuming I can do it with "if then else" statement, but not sure how... Can anyone help me with this, please? I need to solve this ASAP.
User avatar
Gold Boarder

GK User
Tue May 14, 2013 7:05 pm
Just to simplify my issue, I need to change the product description of a specific product based on the page I am on.

I figured I need to create a method (possibly) where it would check if Page ID equals to Product ID and then it would display a specific description (Article ID) for that product.

Anyone, please?
User avatar
Gold Boarder

teitbite
Fri May 31, 2013 10:06 am
Hi

I've seen You asking for my help in PM, but what You want is simply a virtuemart child product functionality. Please check their documentation under this topic and You will find it pretty easy to manage :)
User avatar
Moderator

GK User
Fri May 31, 2013 2:28 pm
Thanks for getting back to me. I will look into it. I appreciate your response.
User avatar
Gold Boarder

teitbite
Sat Jun 01, 2013 5:18 pm
Hi

Ok. Just let me know if You will find my idea not suitable in Your case. I'll come up with something else.
User avatar
Moderator

GK User
Sat Jun 01, 2013 9:12 pm
teitbite wrote:Hi

Ok. Just let me know if You will find my idea not suitable in Your case. I'll come up with something else.


Teitbite, first of all, thank you for trying to help me out.

What I need is to have the same product to be listed on 10 different pages and I need to change the product description depending on the page the user is currently on.

Your solution seems to be fine, but the latest update does not work properly. I think it's a bug and reported it on VM site. When I create a child product, it doesn't inherit the parent information. Everything has to be entered again. Also, I do not know how to list child products separately. So I don't think this solution is working for me, unless I don't know how to properly use it.

Sounds that cloning a product would do the job, but the down side is that if I have tons of products, then I have to update all of them manually.

So what I was thinking is to have a custom code written that would update the product description dynamically. I just don't know how to do that. So probably having a description sitting in articles and having a conditional statement that would check current page ID and display appropriate article would do the job.

What do you think?
User avatar
Gold Boarder

teitbite
Sun Jun 02, 2013 9:07 pm
Hi

Ok. I may have a simplier solution. Why not put all descriptions in one place, but devide it by layers. Example:

Code: Select all
<div class="page1-desc">
Some text
</div>
<div class="page2-desc">
Some text
</div>
....


Than just add a code to show one and hide the rest of it to the page You want to show it:

Code: Select all
.page1-desc { display: block; }
.page2-desc { display: none; }
User avatar
Moderator

GK User
Sun Jun 02, 2013 10:41 pm
teitbite wrote:Hi

Ok. I may have a simplier solution. Why not put all descriptions in one place, but devide it by layers. Example:

Code: Select all
<div class="page1-desc">
Some text
</div>
<div class="page2-desc">
Some text
</div>
....


Than just add a code to show one and hide the rest of it to the page You want to show it:

Code: Select all
.page1-desc { display: block; }
.page2-desc { display: none; }



Teitbite, this does sound like a lot easier solution. So ideally I should have all my descriptions listed in products description in VM back end, right? But so how do I display the description I need using your solution? I am not sure about this part, because its displaying everything from a central location... Thats why I thought I needed some code to check current page.

In other words, how do I use your solution if I have multiple descriptions entered in VM products description field in VM backend?
User avatar
Gold Boarder

teitbite
Mon Jun 03, 2013 3:29 pm
Hi

You need to do this as in my example. Put all descriptions in one place but separate with html layers. Make this layers has different names and than simply show the one You want with a CSS code attached to a page where should it work. You can attach this CSS with mod_blank for example.
User avatar
Moderator

GK User
Tue Jun 04, 2013 4:55 am
teitbite wrote:Hi

You need to do this as in my example. Put all descriptions in one place but separate with html layers. Make this layers has different names and than simply show the one You want with a CSS code attached to a page where should it work. You can attach this CSS with mod_blank for example.


Teitbite,

I really appreciate you helping me out. I figured it out. mod_blank did the job. I did not know how to insert the CSS code...

One last question. Considering the fact that with the future updates, the mod_blank extension might not work properly due to compatibility issues. There is too much to worry down the road... So is there any other way to insert the code inline, hard code it manually? Or is there any other solution?
User avatar
Gold Boarder

GK User
Tue Jun 04, 2013 6:29 am
teitbite wrote:Hi

You need to do this as in my example. Put all descriptions in one place but separate with html layers. Make this layers has different names and than simply show the one You want with a CSS code attached to a page where should it work. You can attach this CSS with mod_blank for example.

Teitbite,

I have encountered another problem that leds me to believe that CSS solution probably isn't going to be the answer. Here's what's happening:

1. I have a category view page that lists two products: product 1 & product 2.
2. I have 5 different pages that list product 1 detail page. So I needed to have different descriptions on 5 different page for the same product as you already know.

With this set up, I am having an issue with the "Product Detail" link in the category view page. Because I have 5 different pages of the same product, system does not know which URL to pick and defaults to the last created page.

This gets very frustrating. I don't know what to do now.

Teitbite, do you know any workaround by any chance? Or is there another solution?
User avatar
Gold Boarder

teitbite
Tue Jun 04, 2013 9:27 pm
Hi

Your request is unusual so it's hard to tell the best solution, but I would keep CSS one. For adding css code You can also use K2 Tools. There is an option for custom scripts there (last option in the module). To make css work You need to put it into:

Code: Select all
<style type="text/css"></style>


On pages where 2 products are listed You can use a better selector for css. For example:

Code: Select all
.product:first-child .desc3 {
display:block;
}

.product:nth-child(5) .desc2 {
display:block;
}


The above is telling which description to show (in my example 3rd description in first product and second in 5th product, etc...)

About multiple linking to the same product I'm afraid the only option would be to create a menu item for each of them. So page will be recognized by Itemid and not alias. This can be done in a separated menu not used on site.
User avatar
Moderator

GK User
Mon Jun 10, 2013 3:12 am
Thanks for your help. I was able to figure it out with child products...:)
User avatar
Gold Boarder

teitbite
Tue Jun 11, 2013 8:27 am
Hi

Yeap :) That was my first thought to make it like that. I'm glad you've made it.
User avatar
Moderator


cron