Hi,

I have just configured attributes for some of my items. Is it possible to show the Item name and the attribute name? At the moment it doesn't matter which attribute SKU I select, it always displays the original title which isn't useful for showing on the receipt what we are selling.

Thanks,
Paul.

Comments

coreywood’s picture

I accomplished this by adding the following code to foreach ($order->products as $product){} in uberpos.module:


     $adjustment = end(multiarray_keys($product->data));
    
     if (empty($adjustment)) {			
     $adjustment = " "; 
     }

      $js['products'][] = array(
        'id' => $product->order_product_id,
        'class' => 'product',
        'type' => 'IT',
        'title' => check_plain($product->title),
        'adjustment' => $adjustment,
        'price' => uc_price($price_info, $context, array(), 'formatted'),
      );

You'll also need to add this function, I threw it at the end of uberpos.module:

function multiarray_keys($ar) {        
		foreach($ar as $k => $v) {			
			$keys[] = $v;
				if (is_array($ar[$k])) {
				$keys = array_merge($keys, multiarray_keys($ar[$k])); 
				}
				return $keys;
	}
}

Then, add the adjustment piece to uberpos.js:

    /* Add new products */
    for(var i in result['products']) {
      p = result['products'][i];
      $('#screen table#main-table tbody').append('<tr id=' + i + ' class="' + p['class'] + '"><td id="' + p['type'] + p['id'] + '" class="product-title"><div class="product-title">'+ p['title'] + "&nbsp;-&nbsp;" + p['adjustment'] +'</td><td class="price">' + p['price'] + '</div></td></tr>');
    }
techypaul’s picture

Category: support » feature

Hi,

Thanks! This works pretty well for me, although when I choose a single item for sale now, I get this type of thing:

Computer Repair - Add On (3)
£0.00
Computer Repair - undefined
£20.00

Any ideas? Is this what happens with yours? I was hoping for more

Computer Repair - Add On (3)
£20

on its own. Also changing this to feature request, because I think it should be in the full release.

Ta,
Paul.