Thread: admin switch

Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    red flag admin switch

    Is it possible to set up a small radio button switch in the admin that can turn a piece of code on or off depending on the product.

    I need to display a size calculator on some products but not others and ideally would like the code to be existent in say tpl_product_info_display.php or similar with a switch in the admin to turn it on or off.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: admin switch

    Just set it up as a configuration option. call it something like MY_NEW_OPTION. Then you will be able to access the constant MY_NEW_OPTION. Then write a little php if statement to surround the code that you want to switch.

    Antother way to do this would be to use a different product type.

  3. #3
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    red flag Re: admin switch

    Ok so can you give me some idea of the code I would need to write and where I would need to put it?
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #4
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: admin switch

    Product types are the easier option probably

    https://www.zen-cart.com/tutorials/i...hp?article=114

    Each product type has its own tpl_product_info_display.php file so you can do what you want.

    Configuration value approach is described in http://www.ferolen.com/blog/add-cust...g-for-zencart/ . Note that the process outlined there would need to be adjusted for Zen 1.5.

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

    Default Re: admin switch

    This sounds like an ideal application for swguy's "boilerplate file" setup (you can find a full description on his website), or my Extra Boilerplate extension of it, posted in How to Add Content Below category listings?, post 5.

    You add a small HTML comment to the description for each product that needs the element.

    If this needs to be PHP, you might need the different product type, or possibly adapt the function to include the PHP file.
    Last edited by gjh42; 12 Jan 2012 at 04:39 PM.

 

 

Similar Threads

  1. v151 Admin demo switch
    By Design75 in forum General Questions
    Replies: 2
    Last Post: 28 Apr 2013, 07:32 PM
  2. no Category Description switch in Admin?
    By finlander in forum General Questions
    Replies: 1
    Last Post: 30 Oct 2010, 06:36 AM
  3. Uninstall HoverBox2 Admin Switch
    By guoxiang in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 7 Oct 2007, 02:40 PM
  4. Admin switch for: PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP
    By kiddo in forum Customization from the Admin
    Replies: 1
    Last Post: 4 Jul 2007, 05:37 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