How to display remaining quantity for a variant

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #93378

Hi

I have an option setup called "Term 1 Week 1" and added to this option is a variant:
For example Tuesday 6pm - 8pm ( + AUD $17.00 )



Could you tell me how I can display the remaining quantity for the variant

For example:
Tuesday 6pm - 8pm ( + AUD $17.00 ) Remaining Spots: 5

Thanks for your help

Patrick

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #93427

Hi,

You can edit the view "product / option" and use the var "$optionElement->product_quantity" to display the quantity where you want.

Please Log in or Create an account to join the conversation.

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #93685

HI Xavier

I changed line 87 in file product\option.php file

$text.=' ( '.($positive?'+ ':'').strip_tags($this->loadTemplate()).' )' . " " . $optionElement->product_quantity;

However, if I have

Option 1 Variant 1 - quantity = 3
Option 1 Variant 2 - quantity = 4

The quantity 3 gets displayed for both Variant 1 and Variant 2.

Could you tell me if that is the correct file and where I should add $optionElement->product_quantity


thanks

Patrick

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93967

Hi,

$optionElement->product_quantity is the quantity of the default variant of the current option.
You should use instead $variant->product_quantity which is the quantity of the current variant of the current option.

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum