PrestaShop Forums: [MODULE] Product attributes as radio buttons and checkboxes - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


[MODULE] Product attributes as radio buttons and checkboxes


[MODULE] Product attributes as radio buttons and checkboxes

#1 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 16 October 2009 - 10:06 AM

This module changes the way attributes are displayed. Instead of displaying them as dropdowns, it displays the attributes in a table along with the price differences including tax. The module can be configured to also display the price differences excluding tax. Attribute groups that have attributes named "Yes" and "No" will be displayed as a checkbox with the group name as the label. All other attribute groups will be displayed as radio buttons.

By default, this module installs itself above the more information section, but it can also be displayed as a tab in the more information section by going to Modules > Positions and transplanting the module into the "Tabs on the product page" and "Content of tabs on product page" hooks, then deleting the module from the "Product footer" hook. Note that if you want to remove the module from this position, you will have to tick "Display non-positionnable hook" before you can remove it from those hooks.

You can find further instructions and see a demo of the module here.

UPDATE: v1.1

- Added option to display no prices, tax included, tax excluded or both

- Added option to hide price differences when they are zero

UPDATE: v1.2

- Fixed a few bugs

- Added option to display full price instead of just the price differences

- Added option to display label above checkboxes: enter the label at the start of the attribute group name followed by the | character

UPDATE: v1.2.1

- Fixed so that product discounts and customer discounts are now displayed in the attribute prices

UPDATE: v1.3

- Added option to display attribute images and weight

- Made description optional

- Changed so that attributes are sorted alphabetically

UPDATE: v1.3.1

- Fixed bug in calculation of price excluding tax

Download this module from my website here.

Attached File(s)

  • Attached File  front.png (64bytes)
    Number of downloads: 16675
  • Attached File  back.png (23bytes)
    Number of downloads: 13488

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#2 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 16 October 2009 - 04:03 PM

Rocky ...you are a champ.

thanks.
Ken

#3 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 17 October 2009 - 04:49 AM

Updated with more tax options and the option to hide price differences of zero.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#4 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 18 October 2009 - 05:32 PM

Rocky

As a special request .Is it possible to get a display of total price as a option (price +attribute +tax ).

Ken.

#5 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 18 October 2009 - 10:41 PM

Good idea. I'll add that as an option when I get time. In the mean time, you can do this by giving the product a price of zero and then adding all the prices as the price differences.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#6 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 19 October 2009 - 04:28 AM

Thanks again Rocky.

Ken

#7 yungan

    PrestaShop Newbie

  • 06 Oct 2009
  • Members
  • Pip
  • 8 posts

Posted 19 October 2009 - 09:47 AM

Hi..
Is it possible this module multiple choice.
My attributes:

Extra option 1:
cheese
tomatoes
Cheddar
Onion
Jambon
Egg

Extra option 2:
cheese
tomatoes
Cheddar
Onion
Jambon
Egg

Extra option 2:
cheese
tomatoes
Cheddar
Onion
Jambon
Egg

Extra option 3:
cheese
tomatoes
Cheddar
Onion
Jambon
Egg

Extra option 4:
cheese
tomatoes
Cheddar
Onion
Jambon
Egg


There are a lot of combinations. Only one attributes group comes out throught multi select checkbox
Sorry. I speak english but very bad ... :D

#8 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 19 October 2009 - 01:13 PM

Updated module to fix bugs, add full price option and label above checkbox option.

@yungan

Here are the two ways you could use my module:

1. You could add cheese, tomatoes, cheddar, onion, jambon and egg checkboxes and the customer can choose as many or as few as they want. Unfortunately, it does not allow you to limit them to selecting four checkboxes or to force them to choose at least one.

2. As you have written above, you could have four sets of radio buttons with all the possible options. This allows you to force the customer to select exactly four options, but the customer could select the same item more than once.

If you are happy with either of these two options, then my module can do what you want.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#9 wallacept

    PrestaShop Apprentice

  • 31 Mar 2009
  • Members
  • PipPip
  • 170 posts

Posted 19 October 2009 - 01:36 PM

not working in presta 1.1
CCampea Store- http://www.ccampea.com/lojacc - Store online motos, bikes, helmets

CCampea Twitter- http://twitter.com/ccampealoja

CCampea Facebook - CCampea Facebook - Store Online Motos, Bikes and Accessories

CCampea ThisNext - CCampea This

#10 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 19 October 2009 - 07:35 PM

Rocky

I set up 3 checkboxes , the Attribute group name as the label is ok but when added to cart the attribute's (yes and no) is displayed. I would like the Attribute group name to display instead of the attributes .Did I go about it wrong ?

Attached File(s)



#11 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 20 October 2009 - 01:48 AM

@wallacept

This module is designed for Prestashop v1.2.4. What's going wrong in Prestashop v1.1?

@kennyh

Thanks for bringing that bug to my attention. Unfortunately, I don't think modules have control over that code. You would have to change the code manually.

In classes/Cart.php, change line 270-271 from:


$attributesList .= $row2['public_group_name'].' : '.$row2['attribute_name'].', ';
$attributesListSmall .= $row2['attribute_name'].', ';


to:


if (strpos($row2['public_group_name'], '|') !== FALSE)
$row2['public_group_name'] = substr($row2['public_group_name'], strpos($row2['public_group_name'], '|') + 1);
$attributesList .= $row2['public_group_name'].': '.$row2['attribute_name'].', ';
if ($row2['attribute_name'] != 'No')
$attributesListSmall .= ($row2['attribute_name'] == 'Yes' ? $row2['public_group_name'] : $row2['attribute_name']) .', ';


I'm not sure whether you made the right choice to use checkboxes. Did you intend to give your customers the option to choose multiple sizes? If you are selling t-shirts, for example, you shouldn't be able to buy a t-shirt that is both small and medium size. Unless it is your intention to choose multiple sizes, I think you should use radio buttons instead, so the customer can only choose one size.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#12 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 20 October 2009 - 05:04 AM

Rocky

Thank you.. problem is solved with your Cart mod. I have tried the radio buttons and they are great too.The product intended for this checkbox arrangement will be sold in a weight of grams.Its not my idea, but it is a requirement for the user to be able to select one or all attributes.Yes you can force one choice by making one a default attribute.One of beauties of this module I found is the ability for the user to add to the cart quickly many variations of the same product.There isn't anything or any attempt like this module for PS .Its really helpful.
Ken

Attached File(s)



#13 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 20 October 2009 - 05:20 AM

You're welcome. I'm happy you've found my module useful and are using it in ways I never imagined.

Can you give me a link to your site so I can see how you are using my module?
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#14 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 20 October 2009 - 07:23 AM

Rocky

just PM you.

#15 jhnstcks

    PrestaShop Fanatic

  • 16 Jul 2008
  • Moderators
  • 1748 posts
  • Location:UK

Posted 23 October 2009 - 05:53 PM

Hi Rocky love this module....is there a way for the module to display whether an attribute changes the price of the product. For example a t-shirt size small adds £1 but large adds £2.

Also is it possible to wrap a long column of attributes into 2 columns? I have a feeling it might not be because of the table.
Don't forget to click the like button on posts if you think it has been helpful.

E-commerce hosting from Scotserve, fast, reliable and affordable.
E-commerce forum - reviews of dropship suppliers, wholesalers, expert advice on shopping cart software and plenty more....

#16 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 23 October 2009 - 11:14 PM

Hi jhnstcks,

Sorry, but I'm not sure that I understand what you mean. There is already an option to display price differences. Do you mean that you want to display both the full price and price difference at the same time? I'm not sure what you mean by wrapping a long column into two columns. Do you mean wrapping into 2 rows?
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#17 jhnstcks

    PrestaShop Fanatic

  • 16 Jul 2008
  • Moderators
  • 1748 posts
  • Location:UK

Posted 24 October 2009 - 06:21 AM

Hi Rocky

I sorted the price thing, i thought that option was for displaying taxes.

As for the columns i want it to look something like the image below.

If it is some css styling I cant work it out, been trying for ages.

I have a feeling it isnt possible because of the way the attributes are called using the foreach command and it will insert them all into one column.

This wont affect me but, i think it would look great if different attribute groups could be put into different columns.

Attached File(s)


Don't forget to click the like button on posts if you think it has been helpful.

E-commerce hosting from Scotserve, fast, reliable and affordable.
E-commerce forum - reviews of dropship suppliers, wholesalers, expert advice on shopping cart software and plenty more....

#18 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 24 October 2009 - 06:43 AM

I'll try to add the option when I have time. Do you want the option to display each attribute group in two columns or all attributes in two columns or both?
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#19 kennyh

    PrestaShop Apprentice

  • 19 May 2009
  • Members
  • PipPip
  • 171 posts

Posted 25 October 2009 - 09:55 AM

Hey Jhnstks

answer the man...

Rocky strickly 2 columns would be great (I just donated you a case of beer)

Thanks again
Ken

#20 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 25 October 2009 - 11:10 AM

Hi kennyh,

Thanks for the donation. I'll work on this once I've finished the website I'm currently working on. I noticed in another thread you wanted an option to add a quantity field next to each attribute to add multiple attributes to the cart in one click. I'll see whether I can do that too.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users