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

JavaScript in Category/Product Description?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-21-2005, 06:42 PM
 
1day2004 1day2004 is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 115
 

Default JavaScript in Category/Product Description?

The Category Description and Product Descriptions are not allowing me to add JavaScript. Everytime I add JS and save it, the screen refreshes with an empty description box. I've tried it with and without literal tags.

Anyone got any ideas what I'm doing wrong?

Version 4.0.8
__________________
Version 4.0.8 Live
Reply With Quote
  #2  
Old 01-26-2005, 05:02 AM
 
Ginestra Ginestra is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 81
 

Default

Ah hah, might be able to help. Spent a long time on an identical problem, and, if this is documented then it's very, very well hidden.

Sure, the Trusted variables fix ( http://forum.x-cart.com/viewtopic.php?t=13682&sid=773e50d2983433efb0fd8d0c 38af9ea3 ) works for html code, but X-Cart is still ripping out other stuff, <Script> included.

Adding this:

define('USE_TRUSTED_SCRIPT_VARS',1);

to the two files mentioned in the above post will have you smiling. Sure, there are security issues if you don't entirely trust any providers who might have access, but, as far as I can see, there are no issues otherwise.

Hope this helps
Reply With Quote
  #3  
Old 01-26-2005, 05:08 PM
 
1day2004 1day2004 is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 115
 

Default

Thanks for the response.

This is what I have right now:

Code:
define('USE_TRUSTED_POST_VARIABLES',1); $trusted_post_variables = array("product_lng_descr","product_lng_full_descr","product_new_descr","product_new_full_descr","descr","fulldescr","posted_data","js_code","javascript_code");

Should I change it to this?:

Code:
define('USE_TRUSTED_POST_VARIABLES',1); $trusted_post_variables = array("product_lng_descr","product_lng_full_descr","product_new_descr","product_new_full_descr","descr","fulldescr","posted_data","js_code","javascript_code"); define('USE_TRUSTED_SCRIPT_VARS',1); $trusted_script_variables = array("descr","fulldescr");

I'm new to x-cart so I just want to make sure I'm inputting the code correctly.
__________________
Version 4.0.8 Live
Reply With Quote
  #4  
Old 01-26-2005, 10:53 PM
 
Ginestra Ginestra is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 81
 

Default

No, you don't need that second line, just:


define('USE_TRUSTED_SCRIPT_VARS',1);

So, you'll end up with:

define('USE_TRUSTED_POST_VARIABLES',1);
$trusted_post_variables = array("product_lng_descr","product_lng_full_descr" ,"product_new_descr","product_new_full_descr","des cr","fulldescr","posted_data","js_code","javascrip t_code");
define('USE_TRUSTED_SCRIPT_VARS',1);

X-Cart is just looking for the variable to be defined, so it would seem, you don't have to then specify the string.
Reply With Quote
  #5  
Old 01-27-2005, 12:47 AM
 
1day2004 1day2004 is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 115
 

Default

I just applied the changes...it's working perfect!

Thanks for your help.
__________________
Version 4.0.8 Live
Reply With Quote
  #6  
Old 01-27-2005, 12:58 AM
 
Ginestra Ginestra is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 81
 

Default

Glad to be able to help for once. This really should be documented, IMO. Cheers.
Reply With Quote
  #7  
Old 05-20-2006, 02:21 PM
  Debra's Avatar 
Debra Debra is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 44
 

Default

I know this is an old post, so I hope that someone will reply! I want to be able to put this in the product description:
Code:
{if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {/if}
I tried the fix for the html and it works great but I am still having problems. Here is what I have changed for

provider/product_modify.php
Code:
define('USE_TRUSTED_POST_VARIABLES',1); $trusted_post_variables = array("product_lng","product_new_descr","product_new_full_descr","descr","fulldescr","posted_data","js_code","javascript_code", "param00"); define('USE_TRUSTED_SCRIPT_VARS',1);

admin/product_modify.php
Code:
define('USE_TRUSTED_POST_VARIABLES',1); $trusted_post_variables = array("product_lng","product_new_descr","product_new_full_descr","descr","fulldescr","posted_data","js_code","javascript_code", "param00"); define('USE_TRUSTED_SCRIPT_VARS',1);

So basically all I added was param00 and define('USE_TRUSTED_SCRIPT_VARS',1);. Is there something I am missing?
__________________
X-Cart version 4.0.14
Reply With Quote
  #8  
Old 05-24-2006, 02:08 PM
 
firelight firelight is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 43
 

Default Javascript in Category Description

Hi,
I tried to modify the two files: admin/product_modify.php and provider/product_modify.php with the following code:
Code:
define('USE_TRUSTED_POST_VARIABLES',1); $trusted_post_variables = array("product_lng_descr","product_lng_full_descr","product_new_descr", "product_new_full_descr","descr","fulldescr","posted_data","js_code", "javascript_code"); define('USE_TRUSTED_SCRIPT_VARS',1);
The description/code still dissapears when I save the changes in my category description.

Am I doing something wrong here?
Thanks in advance for the help.

Xcart 4.0.18
Reply With Quote
  #9  
Old 05-24-2006, 02:28 PM
 
firelight firelight is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 43
 

Default

Ok, I think I found it.
I changed the admin/category_modify.php by adding the following:
Code:
define('USE_TRUSTED_SCRIPT_VARS',1);
to have this as result:
Quote:
define('USE_TRUSTED_POST_VARIABLES',1);
$trusted_post_variables = array("category_lng_description","category_new_des cription","description");
define('USE_TRUSTED_SCRIPT_VARS',1);

This definately allowed me to insert javascript in the category description.

Any input is still very welcome because I'm not a programmer.

Thanks.
Reply With Quote
  #10  
Old 10-05-2009, 01:20 AM
 
rapsearch rapsearch is offline
 

Advanced Member
  
Join Date: Nov 2004
Posts: 47
 

Default Re: JavaScript in Category/Product Description?

Hi,

I'm also upping this old thread as i could not find a newer version.

I have the same issue, i wish to embed audio previews in the detailer description field.

I've modified admin and provider/product_modify.php with the code
so i have:

PROVIDER
define("NUMBER_VARS", "shipping_freight,price,list_price,weight");
define('USE_TRUSTED_POST_VARIABLES',1);
$trusted_post_variables = array("product_lng","product_new_descr","product_n ew_full_descr","descr","fulldescr","posted_data"," js_code","efields","javascript_code","param00");
define('USE_TRUSTED_SCRIPT_VARS',1);

&
ADMIN
define("NUMBER_VARS", "shipping_freight,price,list_price,weight");
define('USE_TRUSTED_POST_VARIABLES',1);
$trusted_post_variables = array("product_lng","product_new_descr","product_n ew_full_descr","descr","fulldescr","posted_data"," js_code","efields","javascript_code","param00");
define('USE_TRUSTED_SCRIPT_VARS',1);

But after saving it still ends up blank.. ideas?
__________________
Version: 4.1.10
Server: Apache/mysql
Location: http://www.rapsearch.com/store
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:48 AM.

   

 
X-Cart forums © 2001-2020