osCmax v2.5 User Manual
Results 1 to 9 of 9

Variable Help!!

This is a discussion on Variable Help!! within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; Hi, I'm new with osCMax and could use a bit of help. My customer wanted a field when he was ...

      
  1. #1
    New Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0


    Default Variable Help!!

    Hi, I'm new with osCMax and could use a bit of help.

    My customer wanted a field when he was adding new products that would indicate by what measure they were being sold (ex - by box, by pound, by kilogram, by the dozen, etc).

    I have successful added a new form field to the admin page categories.php and I have it saving the data to a new field in the database. So far so good!

    However, I can NOT get the new information to display on the front end by editing product_info.tpl.php

    I am using a piece of code identical to this:

    <?php echo $products_format; ?>

    I believe the data isn't being initialized / captured / loaded as a variable I can display.

    HELP!!

  2. #2
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Post Re: Variable Help!!

    You need to retrieve the data, along with everything else, in the select statement.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  3. #3
    New Member
    Join Date
    Feb 2010
    Posts
    9
    Rep Power
    0


    Default Re: Variable Help!!

    if you have your new field added to products table:

    Code:
        $product_info_query = tep_db_query("select p.products_format,p.products_id, pd.products_name, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
        $product_info = tep_db_fetch_array($product_info_query);
    if you have your new field added to products description table:
    Code:
        $product_info_query = tep_db_query("select pd.products_format,p.products_id, pd.products_name, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
        $product_info = tep_db_fetch_array($product_info_query);

  4. #4
    New Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0


    Default Re: Variable Help!!

    Thanks for the responses.

    It's in the products table. I have added the code as wowsaver suggested -- still nothing!

  5. #5
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Default Re: Variable Help!!

    If you read the post again you will notice.

    if you have your new field added to products description table
    Whereas you have put the extra field in the products table not products_description.

    Just change the select to be p.products_format not pd.products_format

    Regards,
    pgmarshall
    _______________________________

  6. #6
    New Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0


    Default Re: Variable Help!!

    The product_info_query uses p.products_format. No luck.

    On the product_info.tpl.php page I've tried:

    <?php echo $products_price; ?> -- nothing;

    <?php echo $p.products_price; ?> -- prints the term "products_price"

    <?php echo $products_info['products_format']; ?> -- nothing;

  7. #7
    New Member
    Join Date
    Feb 2010
    Posts
    9
    Rep Power
    0


    Default Re: Variable Help!!

    let's say your new field is in products table with the field name products_format

    Use this statement in your product_info.tpl.php
    (replace the one at about line 33)


    Code:
    $product_info_query = tep_db_query("select p.products_format,p.products_id, pd.products_name, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
        $product_info = tep_db_fetch_array($product_info_query);
    then echo:
    Code:
    <?php $product_info['products_format']; ?>
    If you have still problems make sure your cleared your cache and your cookies.
    check in your database that you actually have the field products_format in your products table and see if you have any value for this field.

  8. #8
    New Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0


    Default Re: Variable Help!!

    Wowsaver, you are a lifesaver! It finally worked!

    Thanks very much!!

  9. #9
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: Variable Help!!

    Glad to hear you got it to work ...

    Don't forget to click the button (bottom right) to say "thanks" to wowsaver.

    Regards,
    pgmarshall
    _______________________________

Similar Threads

  1. PHP Help Needed - How to get the value of a variable
    By ASasek in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 05-19-2006, 05:08 AM
  2. variable shipping based on weight and price
    By darren777 in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 11-01-2005, 08:16 AM
  3. variable free shipping rate per country
    By mattkern in forum osCMax v1.7 General Mods Discussion
    Replies: 1
    Last Post: 12-17-2004, 03:26 PM
  4. Increasing Session Variable sizes?
    By ryanmhubbard in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 09-30-2004, 08:35 AM
  5. Heavy problems with passed variable and member function
    By Markus in forum osCommerce 2.2 Installation Help
    Replies: 2
    Last Post: 09-15-2003, 06:24 AM

Tags for this Thread

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
  •