Forums / Customization from the Admin / the download radio button

the download radio button

Views: 10,417

Results 1 to 20 of 29
9 Jul 2007, 6:57 AM
#1
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

the download radio button

Hello
I wonder if anyone could point me in the right direction - I feel this is a look and feel issue-
I'm very happy to have got my downloads working, but is it possible to hide the words 'Please Choose', 'Download Zip' and the radio button? It seems silly to ask the customer to make a choice when there is no choice to be made and may just lead to confusion. Doubly so when all my products are downloadable assets anyway. I arrived at this by following tutorials on how to get downloads working.
TIA for any help
Egg

10 Jul 2007, 5:18 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: the download radio button

Just rewrite it to figure out when the radiobutton is in fact an attribute with a download and the only possible choice and whether it should always be selected or not and when it should set it as a hidden selected data that more or less does what the selected radio button does when it is showing ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Jul 2007, 11:49 PM
#3
bananapunk avatar

bananapunk

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: the download radio button

ajeh: i totally didn't understand your answer, but is there any way to hide the "please choose" along with the radiobutton from the customer?

11 Jul 2007, 12:12 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: the download radio button

sure ... you have to re-write all of the code for this and not break the existing code ...

It is on the list of things to do ... but no idea when we will get around to it as it is not at the moment a high priority ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Jul 2007, 10:33 AM
#5
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

Re: the download radio button

Thank you for the reply Ajeh. Alas I am not in a position to write or re-write any kind of code so I'm afraid I didn't understand it either (or rather I understood it but not how to go away and do it!) :)
Lol, I'd hoped there would be some attribute choices I can switch off to achieve this or perhaps a few lines in the manual I could follow :)
Cheers anyway.
Egg

11 Jul 2007, 5:15 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: the download radio button

Afraid there isn't anything built into Zen Cart at this time to make this easy for you ...

At some point we will get to it on the famous list of things to do ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Jul 2007, 7:28 AM
#7
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

Re: the download radio button

OK thanks for the reply Ajeh. Look forward to seeing that to do list go down (lol, I doubt the to do list ever goes down for software developers!)

13 Jul 2007, 2:51 AM
#8
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

egghed:

OK thanks for the reply Ajeh. Look forward to seeing that to do list go down (lol, I doubt the to do list ever goes down for software developers!)

Hi Egghed,

I'm going to have to make the same modification. It will be a couple of days before I have a chance to do so but when I do, I'll share the code with you.

stage

13 Jul 2007, 8:32 AM
#9
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

Re: the download radio button

Stage you're a star, thank you very much!
Egg

15 Jul 2007, 12:49 AM
#10
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

Please be aware that I am relatively new to ZC but I do have a lot of experience with PHP and working on opensource applications. I make that disclaimer because in case this code is contrary to ZC coding standards, they are due to novice error. Also this changes some core code, so absolutely before you do anything make sure you create a backup. Also when I identify line numbers, those are not exact but should be close. The intention is to get you in the right section of the code and necessarily the exact line. Pay close attention to the content of the lines of code rather than the line numbers I use.

I've tested this and it appears to work as desired and does not appear to break anything in the process. My goal because our site is selling only downloads I wanted the cart to function so that if an attribute was a radio button and only had one option, not to display anything associated with attributes for the particular product. The value is still there but I modified it to pass as a hidden value rather than a radio button. Also make sure you have selected radio button as the type and not dropdown which will display as a radio button if there is only one option.

To begin I had a to make some changes to my template. The default template has similiar code, so I'll use that for example. And you should be able to apply it to your own template.

In the tpl_modules_attributes.php around line 29 find this code:

<?php if ($zv_display_select_option > 0) { ?>
```This code checks to see if there are ANY options and if so displays the text to "Choose Options".  I changed that code to this:

> <?php if ($zv_display_select_option > 1) { ?>Now the text will display only if there are more than one option available.

A little further down around line 61 find this code:

<h4 class="optionName back"><?php echo $options_name[$i]; ?></h4> ```This is the code that displays the option name. Since in my case the option is always there and always selected by default, I didn't want to display it. So I applied the same solution as I did for the "Choose Options" text. So I added a line both above and below that line of code. The whole thing looks like this:
<?php if ($zv_display_select_option > 1) { ?>
<h4 class="optionName back"><?php echo $options_name[$i]; ?></h4>
<?php } // show please select unless all are readonly ?>
```The next file I modified, and this is a core file, remember BACKUP, is attributes.php. If you look around line 451 you should find a line of code that looks like this:

switch ($products_options_names->fields['products_options_images_style']) {


//*** begin mod for single option radio button ***********
if($products_options->RecordCount() == 1){
$tmp_radio .= zen_draw_hidden_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"') .'<br />' . "\n";
} else {
//*** end mod for single option radio button *********


//*** begin mod for single option radio button ***********
if($products_options->RecordCount() == 1){
$tmp_radio .= zen_draw_hidden_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"') .'<br />' . "\n";
} else {
//*** end mod for single option radio button *********
switch ($products_options_names->fields['products_options_images_style']) {


$tmp_attributes_image .= '<div class="attribImg">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"') . '<br />' . '<label class="attribsRadioButton fiveA" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</label></div>';

                      }

                      break;

                    } // end of switch statement
                
              } // end of if radio button



              // checkboxes

$tmp_attributes_image .= '<div class="attribImg">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"') . '<br />' . '<label class="attribsRadioButton fiveA" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</label></div>';

                      }

                      break;

                    } // end of switch statement
                //***  begin mod for single option radio button ***********
                } 
                //***  end mod for single option radio button ***********
              } // end of if radio button



              // checkboxes
And that's all there is to it. My suggestion is to take is slow and again make sure that you make a backup before making any changes at all. Also be aware that because there are changes to the core, if you apply an upgrade at some point in the future, you'll have to make these changes again to the new code. Hope this helps.

stage
15 Jul 2007, 8:08 AM
#11
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

Re: the download radio button

Superb, thanks stage. Before I try it can I just check - If I copy my shop folder over to my hard disk and save my database as an sql file from within the server control panel, is that enough to restore the shop should anything go wrong? I'm just a tad concerned because I've spent quite a long time inputting zones etc and really wouldn't want to again :) Never done this before so it would be a good to know (I haven't come across any documentation on the specifics of back-up/restore strategies yet!).
Thanks again,
Egg

15 Jul 2007, 10:11 AM
#12
bananapunk avatar

bananapunk

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: the download radio button

your'e the man stage, this was a really unpleasant detail designwize. good job!

15 Jul 2007, 2:47 PM
#13
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

egghed:

Superb, thanks stage. Before I try it can I just check - If I copy my shop folder over to my hard disk and save my database as an sql file from within the server control panel, is that enough to restore the shop should anything go wrong? I'm just a tad concerned because I've spent quite a long time inputting zones etc and really wouldn't want to again :) Never done this before so it would be a good to know (I haven't come across any documentation on the specifics of back-up/restore strategies yet!).
Thanks again,
Egg

You're welcome, I'm glad I could help. For this particular change you only have to backup the two files I mentioned. It doesn't effect the database. As long as you have a sound backup of those two files, if something goes wrong all you have to do it copy your backups back to your server.

That being said, its not a bad idea for the purpose of general CYA its a good idea to have some regular backup process.

If you are asking about running your shopping cart locally, you can get that set up, but in order to do that you'll need PHP, apache, and MySQL installed locally. Check out either WAMP or XAMPP.

stage

15 Jul 2007, 2:48 PM
#14
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

bananapunk:

your'e the man stage, this was a really unpleasant detail designwize. good job!

Thank you, happy to help.

15 Jul 2007, 2:52 PM
#15
bananapunk avatar

bananapunk

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: the download radio button

there's still one problem left. products with attributes don't have BUY NOW button so customers are forced to click on the DETAILS. Would it be hard to recode?

15 Jul 2007, 3:49 PM
#16
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

Re: the download radio button

stage:

You're welcome, I'm glad I could help. For this particular change you only have to backup the two files I mentioned. It doesn't effect the database. As long as you have a sound backup of those two files, if something goes wrong all you have to do it copy your backups back to your server.

That being said, its not a bad idea for the purpose of general CYA its a good idea to have some regular backup process.

If you are asking about running your shopping cart locally, you can get that set up, but in order to do that you'll need PHP, apache, and MySQL installed locally. Check out either WAMP or XAMPP.

stage

OK, thats cool. I've now started backing up the whole shop at the end of each day's play and the DB in 3 different formats! I've no idea whether they'll restore ok should the time come but I'll have enough roll back options to choose from :)

Cheers
Egg

15 Jul 2007, 4:29 PM
#17
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

egghed:

OK, thats cool. I've now started backing up the whole shop at the end of each day's play and the DB in 3 different formats! I've no idea whether they'll restore ok should the time come but I'll have enough roll back options to choose from :)

Cheers
Egg

As long as the DB is backed up as SQL which I'm sure it likely is for you, its fairly easy to do a restore.

stage

15 Jul 2007, 4:35 PM
#18
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

bananapunk:

there's still one problem left. products with attributes don't have BUY NOW button so customers are forced to click on the DETAILS. Would it be hard to recode?

I'm not sure how that is related, as I said I'm still learning the system. We're just setting up our shopping cart and had the "buy now" button set, but I noticed some times it displayed and other times didn't, it's likely in our case those products where it was showing up didn't have any attributes set yet. I ended up turning it off because it was rather ugly with our template.

I'll take a look in a little bit but there should be some code in the products listing page that checks for that and if so you'd just have to add or actually change the condition it checks for. I'll let you know if I figure anything out.

stage

15 Jul 2007, 5:40 PM
#19
egghed avatar

egghed

New Zenner

Join Date:
Jun 2007
Posts:
21
Plugin Contributions:
0

Re: the download radio button

Hello Stage
Sorry to return to this, I'm just pasting the code in now, but when you suggest altering the line in attributes.php

switch ($products_options_names->fields['products_options_images_style']) {
there are 2 entries. One on line 226 and the other on line 324. I'm pasting blind as a non coder and am assuming it must be the second one as it is nearest to line the line 451 you quote. I have included 2 screens in the hope that you will be able to confirm which it is.
Thanks
Egg

15 Jul 2007, 5:55 PM
#20
stage avatar

stage

New Zenner

Join Date:
Jun 2007
Posts:
54
Plugin Contributions:
0

Re: the download radio button

It's the first one, I should have noted the other clue, to look for the radio button section. The second example you displayed is the "checkbox" section.

Which version of Zen Cart are you using?

stage