Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,154
    Plugin Contributions
    0

    Default Adding Boilerplate text to the Zen Cart Product Description 158

    zen cart 158 fresh install
    PHP Version: 7.4.33 (Zend: 3.4.0)
    Mods: clone a template, display logs, OPC, Bootstrap 3.4

    @swguy
    I receive 2 error logs when inserting the 2 PHP file within the zen cart structure from your website installition instructions.
    HTML Code:
    [26-Nov-2022 18:53:03 America/Denver] PHP Notice:  Undefined variable:  descr_stringlist in  /includes/templates/boot_horn/templates/tpl_product_info_display.php on  line 117
    HTML Code:
    [26-Nov-2022 18:53:03 America/Denver] Request URI:  /index.php?main_page=product_info&cPath=302_305_312&products_id=328,  IP address: 216.177.186.199, Language id 1
    #1   require(/includes/templates/boot_horn/templates/tpl_product_info_display.php)  called at  [/includes/modules/pages/product_info/main_template_vars.php:156]
    #2  require(/includes/modules/pages/product_info/main_template_vars.php)  called at [/includes/templates/boot_horn/common/tpl_main_page.php:202]
    #3  require(/includes/templates/boot_horn/common/tpl_main_page.php) called at [/index.php:94]
    --> PHP Warning: Invalid argument supplied for foreach() in  /includes/templates/boot_horn/templates/tpl_product_info_display.php on  line 117.
    Website instructions:
    HTML Code:
    Create a customized copy of   includes/templates/custom/templates/tpl_product_info_display.php  (from  includes/templates/template_default/templates/tpl_product_info_display.php) 
    
    You will be defining your boilerplate strings in a file  called includes/languages/english/extra_definitions/my_defines.php   Each string will have a PHP "define" statement, and all the strings will be listed in an array.  In this way,  users can simply add and delete strings by editing this one file, rather than having to dig into the internals of Zen Cart. 
    
    We'll use a simple example:  
    <?php  $descr_stringlist = array("PHP_ONE_WEEK_DELAY", "PHP_TWO_WEEK_DELAY", "PHP_THREE_WEEK_DELAY");   define('PHP_ONE_WEEK_DELAY', 'These decals will be shipped in one week after receiving your order.');  define('PHP_TWO_WEEK_DELAY', 'These decals will be shipped in two weeks after receiving your order.');  define('PHP_THREE_WEEK_DELAY', 'These decals will be shipped in three weeks after receiving your order.');   ?>   
    We've defined three constants and added each one to a list called descr_stringlist. 
    
    Now go back to  includes/templates/custom/templates/tpl_product_info_display.php   Change   <!--bof Product description --> <?php if ($products_description != '') { ?> <div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div> <?php } ?> <!--eof Product description -->   to 
      <!--bof Product description --> <?php if ($products_description != '') { ?> <div id="productDescription" class="productGeneral biggerText"> <?php  $stripped_products_description = $products_description; foreach ($descr_stringlist as $varname) {     $stripped_products_description = str_replace($varname, constant($varname), $stripped_products_description); } ?> <?php echo stripslashes($stripped_products_description); ?></div> <?php } ?> <!--eof Product description -->
    Mark
    Hare Do

  2. #2
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,461
    Plugin Contributions
    29

    Default Re: Adding Boilerplate text to the Zen Cart Product Description 158

    For reasons long forgotten, but after a lot of experimentation, I ended up locating the file in
    \includes\languages\english\extra_definitions\boilerplate_text.php

    and using this format

    $GLOBALS['boilerplate_array'] = [
    'ATEQ_TPMS_UPDATE',
    'ATEQ_TPMS_COMPANY', etc...
    ]

    I use a function with this to do the replacement where necessary.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto, Product Listing Sorter...

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,957
    Plugin Contributions
    309

    Default Re: Adding Boilerplate text to the Zen Cart Product Description 158

    In Zen Cart 1.5.8, you have to global the stringlist explicitly.

    $descr_stringlist = array("PHP_ONE_WEEK_DELAY", ...
    $GLOBALS['descr_stringlist'] = $descr_stringlist;
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,154
    Plugin Contributions
    0

    Default Re: Adding Boilerplate text to the Zen Cart Product Description 158

    @swguy

    Thank you for the updated code for this small module and ran perfectly without any debug files.


    includes/languages/english/extra_definitions/YOUR_TEMPLATE/my_defines.php
    HTML Code:
      $descr_stringlist = array("PHP_ONE_WEEK_DELAY", "PHP_TWO_WEEK_DELAY", "PHP_THREE_WEEK_DELAY"); 
    $GLOBALS['descr_stringlist'] = $descr_stringlist; 
    define('PHP_ONE_WEEK_DELAY',  'Notice this unique species of Horned Lizards is only found in these  general areas, which is shown on the left in this regional map.'); 
    define('PHP_TWO_WEEK_DELAY', 'These decals will be shipped in two weeks after receiving your order.'); 
    define('PHP_THREE_WEEK_DELAY', 'These decals will be shipped in three weeks after receiving your order.'); 
    
    ?>
    Last edited by haredo; 27 Nov 2022 at 04:00 PM.
    Mark
    Hare Do

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,957
    Plugin Contributions
    309

    Default Re: Adding Boilerplate text to the Zen Cart Product Description 158

    This is an artifact of the way language files are processed in 1.5.8. I will add it to the release specific upgrade considerations on next checkin.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 17 Oct 2013, 04:32 PM
  2. v139h Categories description text disappears when adding product
    By jarmilka in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 23 Mar 2012, 03:48 PM
  3. Boilerplate mod- separate it from description?
    By Robbie Newbie in forum All Other Contributions/Addons
    Replies: 19
    Last Post: 21 Oct 2010, 04:34 PM
  4. Centralising the product description text on product info page
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 30 Apr 2009, 10:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR