Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Jan 2009
    Posts
    3
    Plugin Contributions
    0

    Default Boilerplate mod- separate it from description?

    Greetings, all, and thanks for an amazing treasure trove of information. I've gotten pretty far in developing my new site and, though I was previously only familiar with HTML, managed to do quite a bit thanks to your posts, mods and patience. A few times I spent that extra half hour searching here or toying with code rather than post...but now I must!

    I successfully ran That Software Guy's Boilerplate mod- http://www.thatsoftwareguy.com/zenca...scription.html

    - and it puts the boiler text right after the description. What I'd like is to put the boiler text separate and further down, below the Add To Cart button. That's where I want to mention a few policies (shipping, etc.) common to items in certain categories. I'm using the category aspect of the mod (second example on TSG's page).

    I have one item up to test it-
    a l e x a n d e r s g i f t s . c a /index.php?main_page=product_info&cPath=65&products_id=180

    I put the code at the end so the regular description is at top, as usual, and then it's repeated at the bottom with the boiler text ("Overview: Delivery...").

    Latest version of ZenCart.

    Thanks,

    Robbie

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Boilerplate mod- separate it from description?

    What you want to do is actually simpler than the standard version of this mod. Since the boilerplate string starts out separate from the description variable, you just need to add an output for it in the appropriate location in tpl_product_info_display.php.
    Something like
    PHP Code:
    <?php echo '<span class="boilerplate">' .  YOUR_BOILERPLATE_TEXT '</span>'?>
    If there is some condition for displaying it (like the category), you will need code to distinguish when the condition is met; otherwise, it will display in all product info pages.

  3. #3
    Join Date
    Jan 2009
    Posts
    3
    Plugin Contributions
    0

    Default Re: Boilerplate mod- separate it from description?

    I understand in general, but I'm not that good with new code. According to TSG, I made a my_defines.php page and it contains-

    PHP Code:
    <?php

    $descr_stringlist 
    = array("PHP_CATBASKETS_DESC""PHP_CATCHOCOLATES_DESC""PHP_CATCOOKIES_DESC"); 

    define('PHP_CATBASKETS_DESC''Overview:<br />Delivery by courrier across Canada- $8. No weekend delivery. <br />Extra charge for wrong address. <br />'); 
    define('PHP_CATCHOCOLATES_DESC''These decals will be shipped in two weeks after receiving your order.'); 
    define('PHP_CATCOOKIES_DESC''These decals will be shipped in three weeks after receiving your order.'); 

    ?>
    (I'm using the first for now while I tinker.)

    And then I added his code where I want it in tpl_product_info_display.php -

    PHP Code:
    <!--bof Product description -->
    <?php if (($products_description != '') || ($current_category_id == 65) ) { ?>
    <div id="productDescription" class="productGeneral biggerText">
    <?php 
       $stripped_products_description 
    $products_description;
       if (
    $current_category_id == 65)  {
          
    $stripped_products_description $stripped_products_description PHP_CATBASKETS_DESC;
       }
       echo 
    stripslashes($stripped_products_description); 
       echo 
    '</div>';
    ?>
    <?php 
    ?> 
    <!--eof Product description -->
    I tried adjusting the above, but it was based on guessing. Would you know how to modify it to do what you're saying?

    Robbie

  4. #4
    Join Date
    Jan 2009
    Posts
    3
    Plugin Contributions
    0

    Default Re: Boilerplate mod- separate it from description?

    I figured it out!

    PHP Code:
    <?php if (($current_category_id == x) ) echo '<span class="PHP_BOILER1_DESC">' .  PHP_BOILER1_DESC '</span>'?>
    (PHP_BOILER1_DESC and others are defined in the new file of my_defines.php)

    Thanks!

    R

  5. #5
    Join Date
    Feb 2008
    Posts
    41
    Plugin Contributions
    0

    Default Re: Boilerplate mod- separate it from description?

    On a similar note...

    I have linked products in multiple categories. For example, Fabric>All Fabrics, and Fabric>by Color>Red. There are dozens of sub-categories in the Fabric department.

    Is there a way to do this other than repeating the line of php over and over for each category? Is that even a good idea? Would it slow down the cart tremendously?

    What I have now is:
    <?php if (($current_category_id ==713) ) echo '<span class="PHP_BOILER1_DESC">' . PHP_BOILER1_DESC . '</span>'; ?>
    <?php if (($current_category_id ==1055) ) echo '<span class="PHP_BOILER1_DESC">' . PHP_BOILER1_DESC . '</span>'; ?>

    Thus hitting 2 of the 100+ categories/subcategories... any thoughts?

    I'm using ZC 1.3.8. I haven't uploaded these changes to my live store yet.

    Thanks,
    Jessica
    www.bestfriendsquilts.com

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Boilerplate mod- separate it from description?

    If it's the same description constant for all of those categories, you can compress the statements into one test on an array of numbers.
    See Parent Categories Separated In 3 sideboxes, post 41, for an example to include all subcats of the given topcats (it is written for use in tpl_categories.php, and would need to be tweaked for use in other files).

    To choose individual subcats for the code execution, remove the (int) from the first line.
    To use in tpl_product_info_display.php, use this
    PHP Code:
    if(in_array($_GET['cPath'], explode(",",'3,7,7_25'))) {
      
    // code to be executed

    Last edited by gjh42; 22 Jan 2009 at 04:06 AM.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Boilerplate mod- separate it from description?

    For tidiness, here is a version to include all subcats of the given topcats, in files like product_listing.php or tpl_product_info_display.php:
    PHP Code:
    if(in_array((int)$_GET['cPath'], explode(",",'3,7,11'))) {
      
    // code to be executed

    List the top category ids, separated by commas, with no spaces.

  8. #8
    Join Date
    Jan 2009
    Location
    Montreal, Canada
    Posts
    228
    Plugin Contributions
    0

    Default Re: Boilerplate mod- separate it from description?

    Can you spell out the code for when there are multiple top categories- NOT subcats- calling the same description constant?

    Example from my tpl_product_info_display...here are two top categories (there are actually five) calling the same description:

    PHP Code:
    <?php if (($current_category_id == 65) ) echo '<span class="PHP_CATBASKETS_DESC">' .  PHP_CATBASKETS_DESC '</span>'?> 
    <?php if (($current_category_id == 66) ) echo '<span class="PHP_CATBASKETS_DESC">' .  PHP_CATBASKETS_DESC '</span>'?>
    Cheers,

    R

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,511
    Plugin Contributions
    126

    Default Re: Boilerplate mod- separate it from description?

    if ( ($current_category_id == 66) ||
    ($current_category_id == 67) ||
    ($current_category_id == 68) ||
    ($current_category_id == 69) ) {
    echo '<span class="PHP_CATBASKETS_DESC">' . PHP_CATBASKETS_DESC . '</span>';
    }
    That Software Guy. My Store: Zen Cart Support
    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.

  10. #10
    Join Date
    Jan 2009
    Location
    Montreal, Canada
    Posts
    228
    Plugin Contributions
    0

    Default Re: Boilerplate mod- separate it from description?

    Whoa, swguy himself! Thanks!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h How to separate product name and description into different table columns?
    By kbrown in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 13 Jun 2012, 08:48 PM
  2. Making Dual Pricing Mod and Add Customer from Admin Mod Work Together
    By r2llc1605 in forum Customization from the Admin
    Replies: 5
    Last Post: 19 May 2009, 04:37 AM
  3. sales report mod rocks! but how do I separate data by vendor?
    By zerocrew in forum Customization from the Admin
    Replies: 1
    Last Post: 26 Feb 2008, 11:42 AM
  4. creating a mod (separate PST & GST on invoice
    By pdprenty in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 16 Feb 2007, 04:04 AM
  5. Download from separate domain?
    By northfork in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 3 Aug 2006, 06:02 PM

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