X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Product code (https://forum.x-cart.com/showthread.php?t=29291)

creative xpress 03-01-2007 11:19 AM

Product code
 
We are beginning to offer video content about some of our products and I am trying to create a link in the long decription that pops a new window and plays the video for that product.

My question is this: Is there any way to have the link carry the product code with it as a url variable without having to hard code the product code for each link?

For example
<a href=" somelocation.php?sku={$product.productcode}">

or would I be forced to do it this way
<a href="somelocation.php?sku=37-0001">

I am trying to make it so that I only have to add a very generic link to the description, that is the same for all products, and then have my script use the product code variable to select the video that needs to be shown. I have tried it a number of ways and the conclusion that I am coming to is that the link in the long description can not use the smarty or php variables.

What am I missing?

Thanks!
Cameron

balinor 03-01-2007 12:07 PM

Re: Product code
 
I don't think you can use smarty in the product description, at least not by default. You could put that link in product.tpl though, and it would automatically show up on every product.

creative xpress 03-01-2007 01:41 PM

Re: Product code
 
The problem is that I don't need it to show up on every product I only need it to show up on products that have a video. That is one of the reasons that I thought about doing it in the description.

I suppose I could add a field to the DB that is a simple yes or no field for having a video then add a call for that field and an if else statement to show the link.

Sounds simple enough but I am sure I will screw it up.

balinor 03-01-2007 01:53 PM

Re: Product code
 
You could also do it with Extra fields....let me know if you want more direction on that method.

creative xpress 03-01-2007 02:35 PM

Re: Product code
 
How would I go about it with extra fields? That sounds like less work. Don't get me wrong I am willing to do the work but extra fields would not affect my upgrades.

Thank you for your help!
Cameron

balinor 03-01-2007 02:53 PM

Re: Product code
 
Ok, two options:

1. You can put the actual html code in the extra field itself

2. You can use the extra field as a yes/no option. If yes, it displays the link on the product page, if no, it doesn't.

Which one do you think would work better for you?

creative xpress 03-02-2007 02:00 PM

Re: Product code
 
I am thinking that method two would work better for me. I don't want my people to have to remember to put the url in the field. I just want them to have a yes or no option and I will fill in the url in the template so that it doesn not change or get mis-typed.

balinor 03-02-2007 03:28 PM

Re: Product code
 
Ok, next question - do you use Extra Fields for anything else?

creative xpress 03-02-2007 04:39 PM

Re: Product code
 
Not currently. We might need to in the future but right now we do not use them.

balinor 03-03-2007 12:41 PM

Re: Product code
 
Ok, what I have done in the past is set up an extra field in the admin area. Call it 'Video' or something that makes it clear what it does. Then in customer/main/product.tpl, add this code where you want the link to the video to appear:

{if $extra_fields[0].field_value}
Code for pop-up
{/if}

That basically says that if the first extra field has a value, show the code. You can enter anything you want in the admin extra field area to get it to show up, but I typically just tell a client to type 'Y' in the box. If you don't want anything to appear for a product, just leave it empty.

Make sense?


All times are GMT -8. The time now is 11:14 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.