Zen Cart Logo
Forums / Zen Cart Code Suggestions / Adding Text to Item Description

Adding Text to Item Description

Locked

Views: 264

Results 21 to 31 of 31
This thread is locked. New replies are disabled.
4 Oct 2010, 2:13 PM
#21
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Adding Text to Item Description

This is what it looks like now:

<!--bof Product description --> <?php echo 'top cat = ' . (int)$_GET['cPath'];//debug ?> <?php if (($products_description != '') || ((int)$_GET['cPath'] == 1) ) { ?> <!--eof Product description -->

My site is https://www.vintagecollectionsonline.com and you can see for yourself what it produces. I can't say thank you enough for helping me.

Jeff

4 Oct 2010, 2:23 PM
#22
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Text to Item Description

Do you really have nothing but blank lines between
$_GET['cPath'] == 1) ) { ?>
and
<!--eof Product description -->
?

If so, that would give PHP code with an opening { after the if, and no closing }. This would cause a fatal error, with results matching what I see now.

4 Oct 2010, 2:38 PM
#23
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Adding Text to Item Description

Okay - I see what went wrong - I forgot the <?php } ?>

Now I see this - top cat = 1 in the product description. I believe this what we have been wanting to test on to verify that the category I need to insert the test as described below in my_defines.php:

<?php $descr_stringlist = array("CAT1_DESC"); define('CAT1_DESC', ' <br> <b>Item Condition and Grading Criteria</b><br> <br> <br> <b>LIKE NEW / EXCELLENT</b> - Near-perfect and free of defects. No tears, no stains, corners must be mostly sharp, some handling wear is allowed. May have original music store stamp, but no extraneous pen or pencil markings. <br> <br> <b>VERY GOOD</b> - A piece with only slight defects. Edges and corners can show some light wear but no tears greater than 1/2 inch. Some light handling wear and/or soiling and/or creases. Stains and other damage are not allowed. May have a music store stamp, label or owner’s name written on cover <br> <br> <b>GOOD</b> - Defects can include handling wear, edge and corner wear, light creases, tears up to 1”, a light water stain (but no damage), up to 50% spine separation, writing, a label, or a store stamp on the cover, or other minor defects. Can be mended inside with tape - no tape on cover. <br> <br> <b>FAIR</b> - Defects can include handling wear, significant edge and corner wear, creases, writing, chipping, 100% spine split, Staples and/or tape on the cover or inside. But still 100% legible and complete. <br> <br> <b>POOR</b> - Can be torn, ragged, mended, stained, stapled, etc. Larger sizes maybe clipped making some of the contents illegible. ') ?>
4 Oct 2010, 4:17 PM
#24
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Text to Item Description

Did you take my debug code in post 16 to mean that you should delete everything below the if(... line? I simply meant to add the debug line in the location shown. Try again, with some more debug lines to find exactly how much is being processed:```php

<!--bof Product description --> <?php echo 'top cat = ' . (int)$_GET['cPath'];//debug ?> <?php if (($products_description != '') || ((int)$_GET['cPath'] == 1) ) { ?> <div id="productDescription" class="productGeneral biggerText"> <?php $stripped_products_description = $products_description; echo ' desc copied. ';//debug if ((int)$_GET['cPath'] == 1) { $stripped_products_description = $stripped_products_description . CAT1_DESC; echo ' CAT1_DESC added. ';//debug } echo stripslashes($stripped_products_description); echo '</div>'; ?> <?php} ?> <!--eof Product description -->
4 Oct 2010, 4:23 PM
#25
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Text to Item Description

You have an error in the define. It uses single quotes to show where the defined text begins and ends, but you have an unescaped single quote in the middle of the text, which breaks the define statement.

<b>VERY GOOD</b> - A piece with only slight defects. Edges and corners can show some light wear but no tears greater than 1/2 inch. Some light handling wear and/or soiling and/or creases. Stains and other damage are not allowed. May have a music store stamp, label or owners name written on cover
<br>

Make this

owner\’s

and it will work correctly.

4 Oct 2010, 4:50 PM
#26
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Adding Text to Item Description

I made the change and still nothing produced in item description. I removed all the text and just a simple 'Just a test' to ensure no other words were causing a problem.

I now get the product information but I do not get any of the text from my_defines.php

<?php $descr_stringlist = array("CAT1_DESC"); define('CAT1_DESC', 'Just a test') ?>

Here is the code from my current tpl_product_info_display.php

<!--bof Product description --> <?php if (($products_description != '') || ($current_category_id == 1) ) { ?> <div id="productDescription" class="productGeneral biggerText"> <?php $stripped_products_description = $products_description; if ($current_category_id == 1) { $stripped_products_description = $stripped_products_description . CAT1_DESC; } echo stripslashes($stripped_products_description); echo '</div>'; ?> <?php } ?> <!--eof Product description -->
4 Oct 2010, 4:55 PM
#27
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Text to Item Description

You're back to $current_category_id which will not work at all for you.

4 Oct 2010, 5:00 PM
#28
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Adding Text to Item Description

I thought by copying the code from your directions would work - I don't know what else to do at this point. I really would hate to have to go back and manually put in the text. Can you suggest a fix?

4 Oct 2010, 7:06 PM
#29
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Text to Item Description

You didn't copy the code from my directions. Copy/paste the code in post 24 to see what processing is happening. Then we can get an idea of what needs fixing.

4 Oct 2010, 8:35 PM
#30
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Adding Text to Item Description

Sorry - here is what the section in tpl_product_info_display.php looks like:

<!--bof Product description --> <?php echo 'top cat = ' . (int)$_GET['cPath'];//debug ?> <?php if (($products_description != '') || ((int)$_GET['cPath'] == 1) ) { ?> <div id="productDescription" class="productGeneral biggerText"> <?php $stripped_products_description = $products_description; echo ' desc copied. ';//debug if ((int)$_GET['cPath'] == 1) { $stripped_products_description = $stripped_products_description . CAT1_DESC; echo ' CAT1_DESC added. ';//debug } echo stripslashes($stripped_products_description); echo '</div>'; ?> <?php} ?> <!--eof Product description -->

If you check my website out - when selecting a product - nothing shows up: https://www.vintagecollectionsonline.com

:frusty:

4 Oct 2010, 10:06 PM
#31
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Text to Item Description

There is a fatal error somewhere in your current copy of that file. I don't see anything wrong in the part you posted.

Try making a fresh copy from the /template_default/ folder and apply the mod to it.