4 replies [Last post]
michels's picture
Offline
Uber DonorBug FinderInternationalizationizer
Joined: 08/12/2007
Juice: 205
Was this information Helpful?

Heyho.
I annotate this in a discussion with a shop owner:

At the moment (Beta6) if you set the attribute settings to "Display total price", the total price "will only be displayed on products with only one attribute.".

Correctly it must be, that the total price "will only be displayed on products with only one attribute or if the other attributes has no options.".

Can you follow me? Smiling

I fixed that with an extra SQL-Statement in uc_attribute.module, function _uc_attribute_alter_form(). The first two lines are now:

<?php
$numresult
= db_query("SELECT * FROM {uc_product_attributes} WHERE nid = %d AND default_option != 0 ORDER BY ordering", $product['nid']['#value']);
$total_attributes = db_num_rows($numresult);
$result = db_query("SELECT * FROM {uc_product_attributes} WHERE nid = %d ORDER BY ordering", $product['nid']['#value']);
?>

Instead of

<?php
$result
= db_query("SELECT * FROM {uc_product_attributes} WHERE nid = %d ORDER BY ordering", $product['nid']['#value']);
$total_attributes = db_num_rows($result);
?>

$total_attributes now counts only the attributes which have at least one option.

Seems to work for me know. Maybe you want to implement this in the next releases.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Attribute "Display total price" small suggestion

Sounds good to me. One extra query there shouldn't hurt.

cYu
cYu's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 11/19/2007
Juice: 850
Re: Re: Attribute "Display total price" small suggestion

Extremely minor, but the description text on the attribute config screen,
"Formats the price is in the attribute selection form when the customer adds a product to their cart. The total price will only be displayed on products with only one attribute." can be updated to reflect this change.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Attribute "Display total price" small suggestion

Done.

yesct@drupal.org's picture
Offline
Uber Donor
Joined: 11/18/2008
Juice: 294
what does not affect the price really mean?

if I have an attribute that has 2 options: plain and super +$40, and another attribute that has 2 options: red and blue (which have a 0 $ offset), .... it will not calculate the total price and display it ... because there are two attributes, even though one does not affect the price, huh?