Hi,

I am trying to use http://www.ubercart.org/project/uc_color_attribute, but as lots of other uc moduels aac is incompatible of working with it.
Someone explained me that as following; The problem is that ubercart ajax attribute calculations uses javascript to remove the current attribute form, which the colour boxes are attached to and then regenerates it using form HTML, but it doesnt check any other drupal modules when rendering the new attribute form...

Could you may be change this fine module, so it check if other modules are doing also something with the attribute form, and than also add this info to the regeneration?
Now I think AAC is incompatible, and there are some patches to modules (see:http://drupal.org/node/1003182), but of course to change this at the source, right?

Thanks a lot for considering this in advance!

greetings,
Martijn

Comments

chertzog’s picture

Ive got the same problem. Ive been trying to figure out a way to make it so the uc_aac only targets the attributes that have price adjustments associated, but so far no luck.

Ive figured out this section of the is what replaces the attributes, but i cant figure out how to make it target certain attributes.

var node = $('#node-' + data.nid);
      for (var i in data.replacements) {
        var replacement = $(data.replacements[i]);
        $(node).find('.' + i).after(replacement).remove();
      }
chertzog’s picture

i figured out a way to do this without the module. I know its not the best solution, but I'm on a deadline, and needed this functionality. What i did was use some jquery and javascript to extract the dollar figure from the attribute option, then pull in the price of the item, and add the two.

Since I actually had 2 different attributes that affected the price of the item, i needed to put in error checking for when one or the other is not selected. The one thing that i cant figure out how to do is add this automatically to attributes that have price changes associated. So for now, you have to get the id of the select box and manually add it to the script. And in turn, you will have to add additional "value" variables and its corresponding value > 0 checker to account for each price changing attribute. But until then...


$(document).ready(function(){
    $("#edit-attributes-4, #edit-attributes-3").change(onSelectChange);
});

function onSelectChange(){
    var value = $('#edit-attributes-4 option:selected').text();
	var v = Number(value.split('$')[1]);
	
	var value1 = $('#edit-attributes-3 option:selected').text();
	var v1 = Number(value1.split('$')[1]);
	
	var price = $('.uc-price-sell').text();
	var p = Number(price.split('$')[1]);
	

	if(v > 0 && v1 >0){
		var total = v+v1+p;
	}else if(v > 0 && !(v1 >0)){
		var total = v+p;
	}else if(!(v > 0) && v1 >0){
		var total = v1+p;
	}else{
		var total = p;
	}
   
$('.uc-price-display').replaceWith('<span class="uc-price-product uc-price-display uc-price">$'+total+'</span> ');
}
stewart.adam’s picture