Hi, I was looking for a way to add more products in 'Deal' content type. I change the product reference field to more than 1. But it always return in error :
Fatal error: Call to a member function value() on a non-object in xxx/profiles/opendeals/modules/custom/opendeals_module/opendeals_module.module on line 166

opendeals_module.module on line 166 is :
$stock = $wrapper->field_product->field_stock->value();

My Questions are:
1. Any chance that I can add more products options/variant ?

2. I want to create many different products into Product Type so I need many product options. Can I have many different options for 1 product type ?

3. I had tried to use Commerce Product Options, but I cannot set the price individually per product option/variant. What is the proper way to have many product options and set different prices individually ?

Example: I want to sell Theatre X voucher that has options:

  • VIP Seat $500
  • Front Row $200
  • Mid Row $120

I also want to sell Beauty Salon voucher that has options:

  • Cut Only $100
  • Cut + Blow $200
  • Spa $120
  • Cut + Spa $160

Thank you.


yannisc’s picture

Have you accomplished what you ask for?

yannisc’s picture

Status: Active » Postponed (maintainer needs more info)
mindhunter75’s picture

I really would like to know a solution too!


moshikoh’s picture


There is a solution for that, just change the lines to:

	$stock = $wrapper->field_product[0]->field_stock->value();
	$sales = $wrapper->field_product[0]->commerce_sales->value();

when there is more then one product the var "field_product" turn into array.

now it will support more then one product.

you can see example here:


mindhunter75’s picture

Hye Moshikoh,

This works! only one problem....

The "discount" and the "you save" fields are not responding when i choose another product from the dropdown reference.

Only "From price" "too price" changes in the AJAX.

Any idea how to fix this?

At least i'm a step further! thank you!

abhishek.inext’s picture

Status: Postponed (maintainer needs more info) » Active

Hello All,

I am also stuck at the last point where:-

The "discount" and the "you save" fields are not responding when i choose another product from the dropdown reference.

I am not getting which Ajax file is returning the other values, I am newbie to Drupal.

Please provide me some information for the same.

Waiting to hear back soon.

Abhishek Arora

abhishek.inext’s picture

Issue summary: View changes

Add more words, hope to make it more clear.