Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Product code

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-01-2007, 11:19 AM
 
creative xpress creative xpress is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 71
 

Default 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
__________________
Xcart
Version: 4.1.6
Reply With Quote
  #2  
Old 03-01-2007, 12:07 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 03-01-2007, 01:41 PM
 
creative xpress creative xpress is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 71
 

Default 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.
__________________
Xcart
Version: 4.1.6
Reply With Quote
  #4  
Old 03-01-2007, 01:53 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Product code

You could also do it with Extra fields....let me know if you want more direction on that method.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 03-01-2007, 02:35 PM
 
creative xpress creative xpress is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 71
 

Default 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
__________________
Xcart
Version: 4.1.6
Reply With Quote
  #6  
Old 03-01-2007, 02:53 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #7  
Old 03-02-2007, 02:00 PM
 
creative xpress creative xpress is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 71
 

Default 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.
__________________
Xcart
Version: 4.1.6
Reply With Quote
  #8  
Old 03-02-2007, 03:28 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Product code

Ok, next question - do you use Extra Fields for anything else?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #9  
Old 03-02-2007, 04:39 PM
 
creative xpress creative xpress is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 71
 

Default Re: Product code

Not currently. We might need to in the future but right now we do not use them.
__________________
Xcart
Version: 4.1.6
Reply With Quote
  #10  
Old 03-03-2007, 12:41 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020