Forums / General Questions / where to find the code that does the radio button?

where to find the code that does the radio button?

Views: 1,081

Results 1 to 10 of 10
5 Apr 2013, 6:02 AM
#1
denniszc avatar

denniszc

New Zenner

Join Date:
Mar 2013
Posts:
95
Plugin Contributions:
0

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..

5 Apr 2013, 6:49 AM
#2
denniszc avatar

denniszc

New Zenner

Join Date:
Mar 2013
Posts:
95
Plugin Contributions:
0

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

........

5 Apr 2013, 7:31 AM
#3
denniszc avatar

denniszc

New Zenner

Join Date:
Mar 2013
Posts:
95
Plugin Contributions:
0

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

for example, in this code from the shopping_cart.php

$text_words = zen_get_word_count_price([B]$this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']][/B], $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?

5 Apr 2013, 2:58 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

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.

8 Apr 2013, 1:11 AM
#5
denniszc avatar

denniszc

New Zenner

Join Date:
Mar 2013
Posts:
95
Plugin Contributions:
0

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

DrByte:

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

8 Apr 2013, 1:47 AM
#6
denniszc avatar

denniszc

New Zenner

Join Date:
Mar 2013
Posts:
95
Plugin Contributions:
0

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:

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

8 Apr 2013, 2:59 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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 Apr 2013, 7:05 AM
#9
denniszc avatar

denniszc

New Zenner

Join Date:
Mar 2013
Posts:
95
Plugin Contributions:
0

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?

8 Apr 2013, 11:45 AM
#10
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

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