Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2013
    Location
    Portishead, North Somerset, United Kingdom
    Posts
    34
    Plugin Contributions
    0

    Default Base price as a PHP variable

    Hi Guys,

    I'm working on my product page, i.e. includes/templates/mytemplate/templates/tpl_product_info_display.php

    I need to get the current base price and define it as a php variable so that I can use it in an on page calculation. I can see that there is a load of script to display the base price, but I cannot figure out how to make it a variable. Something like:

    $base_price = get_products_price($products_id);

    Any of you guys that know PHP and can shed some light on this it would be most helpful.

    Kind Regards

    Matt

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,496
    Plugin Contributions
    88

    Default Re: Base price as a PHP variable

    How about
    Code:
    $base_price = get_products_base_price ($products_id);

  3. #3
    Join Date
    Oct 2013
    Location
    Portishead, North Somerset, United Kingdom
    Posts
    34
    Plugin Contributions
    0

    Default Re: Base price as a PHP variable

    Quote Originally Posted by lat9 View Post
    How about
    Code:
    $base_price = get_products_base_price ($products_id);
    Thanks, I'll give that a try!

  4. #4
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Base price as a PHP variable

    Although not 100% accurate, a helpful tool for such function search is the published docs for zc 1.5.0 (http://www.zen-cart.com/docs/phpdoc-1-5-0/)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Oct 2013
    Location
    Portishead, North Somerset, United Kingdom
    Posts
    34
    Plugin Contributions
    0

    Default Re: Base price as a PHP variable

    Thanks everyone,

    I achieved it using:
    PHP Code:
    <?php echo zen_get_products_base_price((int)$_GET['products_id']) ;?>

  6. #6
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Base price as a PHP variable

    Question about the usage of the above, understand that it is used on the product_info page which ought not be displayed without a products_id, but I would suggest at least coding this section applicably. Or to put it another way, I kinda get the willies when I see GET statements used directly without some form of validation. The validation may already be there (executed before the above code), but just one of those "system views".
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,496
    Plugin Contributions
    88

    Default Re: Base price as a PHP variable

    Quote Originally Posted by mc12345678 View Post
    Question about the usage of the above, understand that it is used on the product_info page which ought not be displayed without a products_id, but I would suggest at least coding this section applicably. Or to put it another way, I kinda get the willies when I see GET statements used directly without some form of validation. The validation may already be there (executed before the above code), but just one of those "system views".
    The fact that the value is cast to an (int) should be "validation" enough.

 

 

Similar Threads

  1. Price by attribute turned off but still adding base price
    By Rickk123 in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 26 Aug 2010, 11:19 PM
  2. Replies: 17
    Last Post: 21 Mar 2010, 05:57 PM
  3. Replies: 3
    Last Post: 3 Aug 2009, 06:13 AM
  4. Including Attribute Price Factor In Base Price Dropdown Menu
    By rob28870 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 1 Oct 2008, 10:14 AM
  5. Base Price, then reduced price for additional quantities
    By leighbee in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 7
    Last Post: 30 Aug 2007, 01: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