
Originally Posted by
lsde
Current version 1.5.7b
Using 1 option name with "SBA Select List (Dropdown) Basic" and I would like to rearrange how the quantity and price show in the dropdown. Current order is option value + stock qty + price. Would like to have it read option value + price + stock qty.
Pretty sure I need to edit class.products_with_attributes_stock.php not sure where. Any guidance would be appreciated.
Thanks
lsde, I apologize for two things, one in attempting to create my post about the quantity box, I lost what I had researched and begun creating to answer your question, two is that I had not completed that response in a more timely manner.
Basically, the stock quantity text is generated and incorporated in $PWA_STOCK_QTY within includes/classes/observers/class.products_with_attributes_stock.php.
The "safest" way that I see to resequence the data so that the newly added stock quantity does not appear in other potentially undesirable areas, would be to add an additional notifier to your copy of includes/modules/YOUR_TEMPLATE/attributes.php after this code group:
Code:
$zco_notifier->notify('NOTIFY_ATTRIBUTES_MODULE_ORIGINAL_PRICE', $products_options->fields, $products_options_array, $products_options_display_price, $data_properties);
$products_options_array[count($products_options_array) - 1]['text'] .= $products_options_display_price;
to look something like this:
Code:
$zco_notifier->notify('NOTIFY_ATTRIBUTES_MODULE_ORIGINAL_PRICE', $products_options->fields, $products_options_array, $products_options_display_price, $data_properties);
$products_options_array[count($products_options_array) - 1]['text'] .= $products_options_display_price;
$zco_notifier->notify('NOTIFY_ATTRIBUTES_MODULE_AFTER_ORIGINAL_PRICE', $products_options->fields, $products_options_array, $data_properties);
The reason is this: The developers and associated code maintainers have merged in the price to the notifier: NOTIFY_ATTRIBUTES_MODULE_ORIGINAL_PRICE, such that if $products_options_display_price is modified to include your desired stock quantity at the end, it will impact later usage of that variable. Further there is no notifier before the next addition of text to $products_options_array[nth_value]['text'] to force/guarantee that the quantity would be the next value added because weight information is possibly the next content to be added to that array value. Then if weight information isn't added, the next existing code opportunity is to use the observer: NOTIFY_ATTRIBUTES_MODULE_BEFORE_ASSEMBLE_OUTPUTS with a forced global in that observer to update that text or for specifically observing about 'SBA Select List' to do similar in the observer for NOTIFY_ATTRIBUTES_MODULE_DEFAULT_SWITCH (again recognizing that this addition would be after any expected addition of weight related text).
If the text is added directly to the price related information, then note that $products_options_details and $products_options_details_noname will each also include that additional information and that there are unevaluated downstream affects of that additional content.
Bookmarks