Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2013
    Posts
    95
    Plugin Contributions
    0

    Default where to find the code that does the radio button?

    hey guys, want to ask which part of the code deals with the radio button/ checkbox and dropdown box calculations? im trying to get these 3 variables to be used inside the price per word/letters calculations.. i want to make it so that if i choose a certain option from the radio button, there will be an extra calculation added using the height and width value the customer typed in into the text area..

  2. #2
    Join Date
    Mar 2013
    Posts
    95
    Plugin Contributions
    0

    Default Re: where to find the code that does the radio button?

    ........
    Last edited by denniszc; 5 Apr 2013 at 07:55 AM.

  3. #3
    Join Date
    Mar 2013
    Posts
    95
    Plugin Contributions
    0

    Default Re: where to find the code that does the radio button?

    for example, in this code from the shopping_cart.php

    Code:
    $text_words = zen_get_word_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_words_free'], $attribute_price->fields['attributes_price_words']);
    the $this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']] corresponds to the string value in the text area text attribute.. how do i do something similar for radio buttons/checkbox or dropdown box?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: where to find the code that does the radio button?

    The form field elements for attributes are built by the /includes/modules/YOUR_TEMPLATE_NAME/attributes.php and output by /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_modules_attributes.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Mar 2013
    Posts
    95
    Plugin Contributions
    0

    Default Re: where to find the code that does the radio button?

    Quote Originally Posted by DrByte View Post
    The form field elements for attributes are built by the /includes/modules/YOUR_TEMPLATE_NAME/attributes.php and output by /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_modules_attributes.php
    do you mean includes/modules/attributes.php? i didnt see any in my templates folder.. also, how does it work exactly? for example, the text strings, i understand why i can use it in the zen_get_word_count_price function since i included it in the function (I.E: FUNCTION_NAME(*included in here*)), but why is it that i can use it in any other functions by just copying this = $this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], in the shopping_cart.php file

  6. #6
    Join Date
    Mar 2013
    Posts
    95
    Plugin Contributions
    0

    Default Re: where to find the code that does the radio button?

    okay, right after i posted the reply it actually got me thinking as well.. from the code you cant really see any part that specifies whether or not it is a TEXT attribute or not, so why is it that if i call the code, the TEXT attribute will be used? after thinking about this i immediately saw the word PRODUCT_OPTIONS_TYPE_TEXT, i thought this must be the one that identifies the TEXT attributes, so immediately after i searched around and found similar variable type for checkboxes and radio buttons and now i can successfully call any attribute types in any function.. to those who are wondering here's what i did, to use the checkbox just use:

    Code:
    if (zen_get_attributes_type($attribute_price->fields['products_attributes_id']) == PRODUCTS_OPTIONS_TYPE_CHECKBOX){
    				$checkbox = $this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']];
    			}
    this part of the code = $this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']]; will call the attributes of whichever the $PRODUCTS_OPTIONS_TYPE_XXXX calls, once you've done this just insert the variable into the function's bracket and you're done

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

    Default Re: where to find the code that does the radio button?

    Good work! And thanks for sharing...
    do you mean includes/modules/attributes.php? i didnt see any in my templates folder..
    You are supposed to copy the file from its default location (where you found it) and save the edited copy in your custom template folder as DrByte described.

  8. #8
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: where to find the code that does the radio button?

    And here are a couple of tutorials that explain the override system

    http://www.zen-cart.com/content.php?...verride-system
    http://www.zen-cart.com/content.php?...-files-to-edit
    Zen-Venom Get Bitten

  9. #9
    Join Date
    Mar 2013
    Posts
    95
    Plugin Contributions
    0

    Default Re: where to find the code that does the radio button?

    what is the value that is used for the checkboxes? what value determines which checkbox i have chosen and which one i have not?

  10. #10
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: where to find the code that does the radio button?

    what value determines which checkbox i have chosen and which one i have not?
    If you are referring to attributes then this is done from the admin
    Zen-Venom Get Bitten

 

 

Similar Threads

  1. Where does the Facebook Like button code go?
    By MagicMan in forum General Questions
    Replies: 1
    Last Post: 8 Mar 2014, 03:14 PM
  2. v151 Where are the code that handle the shipping estimator POST data
    By su35 in forum General Questions
    Replies: 2
    Last Post: 31 Jan 2014, 10:05 PM
  3. Where is the code that sends order data to the database?
    By bparker in forum General Questions
    Replies: 1
    Last Post: 15 May 2013, 05:37 PM
  4. Replies: 5
    Last Post: 29 Jan 2008, 01:07 AM
  5. What does the Free Shipping Radio button do?
    By MCanes in forum General Questions
    Replies: 7
    Last Post: 4 Nov 2007, 07:54 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