Hi. I am virtually pulling my hair out

I have spent a whole day just trying to do one thing. To remove the colon " : " that show on the cart and checkout page when your product has an attribute.

For example in you have a Bag product with "Color" Attributes as "blue" in your in your cart it will show on the cart page as:

Product Title => Bag
Attribute      => Color : Blue

All i have been trying to do for the past 8 hours was to find the function or the tag that output the Colon. I want my display to show as:

Product Title => Bag
Attribute      => Blue

I want to remove the attribute label "Color" and the colon " : " in the attribute output from the display in the cart and checkout page.

However, i took a look into uc_attribute.test located in example.com/sites/all/modules/ubercart/uc_attribute/test/ on line 736 , there is a code there such as

 // Cart display.
    $price = uc_currency_format($product->sell_price + $option->price);
    $edit = array('attributes[' . $attribute->aid . ']' => $option->oid);
    $this->drupalPost(NULL, $edit, 'Add to cart');
    $this->assertText($attribute->label . ': ' . $option->name, 'Attribute and selected option found in cart');
    $this->assertText($price, 'Adjusted price found in cart');

    // Checkout display.
    $this->drupalPost(NULL, array(), 'Checkout');
    $this->assertText($attribute->label . ': ' . $option->name, 'Attribute and selected option found at checkout');
    $this->assertText($price, 'Adjusted price found at checkout');
    $this->checkout();

I tried changing the line
$this->assertText($attribute->label . ': ' . $option->name, 'Attribute and selected option found in cart');

And changed it to

$this->assertText($option->name, 'Attribute and selected option found in cart');

by removing [($attribute->label . ': ' ] and save, cleared the cache and run cron but my display in cart and checkout page are still there with the colon

If i may ask, what is the use of the .test file and how can i just simply solve this issue by removing the attribute label and the semi colon. Thanks

Comments

docans’s picture

Here is the solution i have found after long hours of headaches

The file to modify is the uc_attribute.admin.inc on line 1089 which is

      $option_rows[$key] = t('@attribute: @option', array('@attribute' => $attributes[$key]['#attribute_name'], '@option' => $optionstr));

I just had to change it to

      $option_rows[$key] = t('@attribute @option', array('@attribute' => $attributes[$key]['#attribute_name'], '@option' => $optionstr));

by taking away the colon next to " t('@attribute: "

A much better way will be to copy the theme function at line 1070 and create a theme function overide in your template.php file

docans’s picture

Assigned: Unassigned » docans
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.