Jump to content

Add item description to index.inc.tpl


Guest
 Share

Recommended Posts

Hey all, thanks in advance for your help.. I have a small modification I want to make on the index.tpl and I cant seem to get it to work.

I want to pull the item description that you get on the viewProduct and add that on the index as well. I have taken the php statement {TXT_DESCRIPTION} and added this to the index however the rel path obviously is missing because nothing shows up. Has anyone else made this modification or similar? Thanks!

update:

I've located the MySQL query tables and found the description value in the viewProd.inc.php.

$latestProducts = $db->select("SELECT productId, image, price, description, name, sale_price FROM ".$glob['dbprefix']."CubeCart_inventory WHERE `showFeatured` = 1 ORDER BY productId DESC LIMIT ".

I added this to the index db query table values however since I'm not really a php developer I merely understand the code, I am unsure how to fulfill the next steps in getting the actual descriptions to display. I've only been working with this for 2 days and my dry erase board looks like a PS Madden Footbal playbook.

Here is the portion I believe I need however cannot restate.

/----------------------------------------------/Part1/------------------------------------------------/

the loop

if($prodArray == TRUE){

$val = "";

if(($val = prodAltLang($prodArray[0]['productId'])) == TRUE){

$prodArray[0]['name'] = $val['name'];

$prodArray[0]['description'] = $val['description'];

}

/----------------------------------------------/Part2/------------------------------------------------/

the statement

$view_prod->assign("LANG_PRODINFO",$lang['front']['viewProd']['product_info']);

or perhaps this is not it at all and it's not quite this complicated??? I am not sure.

UPDATE

I haven't any luck however I have modified the following:

if($config['showLatestProds']==1 && $latestProducts==TRUE){

for($i=0;$i<count($latestProducts);$i++){

if(($val = prodAltLang($latestProducts[$i]['productId'])) == TRUE){

$latestProducts[$i]['name'] = $val['name'];

$latestProducts[$i]['description'] = $val['description'];<--- added to the loop to be called for each product in the array

}

/----------------------------------------------/Part2/------------------------------------------------/

$index->assign("VAL_WIDTH", $config['gdthumbSize']+75);

$index->assign("TXT_SALE_PRICE", priceFormat($salePrice));

$index->assign("VAL_PRODUCT_ID",$latestProducts[$i]['productId']);

$index->assign("VAL_PRODUCT_NAME",validHTML($latestProducts[$i]['name']));

$index->assign("VAL_DESCRIPTION", validHTML($latestProducts[$i]['description']));

$index->parse("index.latest_prods.repeat_prods");

And still a no-go...

UPDATE

It woks however it's throwing everything out of format and is showing the text for the div that it resides in as well.. removing the div from the index.. looks like its going to work. muahahaha... remove the "validHTML" or it will also parse the div statement as text and throw everything off... everything from here a matter of realigning the div to fit.

Link to comment
Share on other sites

You need to alter the include/content/index.inc.php file

thanks....

well here is the process you can use to edit item descriptions into the index page should you so choose to do so.

There are two files you must edit... you need ot edit

the index.inc.php to allow description from the database be parsed...

the index.tpl to add the {VAL_DESCRIPtION} and align the formatting of the div to make it display correctly.

I probably would have gotten this hours ago however like I said I'm not a php developer.. Anyone that can understand php can do this though for sure.

Link to comment
Share on other sites

I see you've not looked in the third-party site documentation frequently asked questions. It's all documented for you there!

I love this..

well Rob thank you for responding. But I have to admit when time is of the essence searching through online pages is more time consuming than the primary two options.

1.) Ask someone directly that knows (i.e. forums)

2.) figure it out yourself or until you get stuck

Also as I mentioned I have only been messing around with cubecart for 2 days today being the second day, and not very familiar with whats been documented and what hasn't and where things are which also takes time. Something that has often urked me, that when you run into an issue, rarely ever two problems are identical ergo leading to completely different quandaries. That has an emphasis when it comes to web development since no two sites are the same. Where I already had a very specified matter to attend, reading how someone else modified some other code to do something else isn't necessarily going to aid me in my mission. I figured this issue out in 10 minutes and kept updating the page. I couldn't have have searched the site, found the documentation I needed to read, read it, and edit the code faster than I logically manipulated the code. It would have been even faster had someone who previously done it answered my post instead of telling me to go somewhere to read.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...