QTpro

Option not selecting on return from shopping cart - QTpro

Option not selecting on return from shopping cart

by radhavallabh » Fri May 27, 2022 5:57 am

Hi dear;
I am using version 1.0.8.14 and the latest package of QT Pro
On default install version
1. We add product Shiny Apples to cart with Box 12
2. On shopping_cart.php we click on a product with attributes- Shiny Apples
3. On return to product_info .php Shiny Apples- The defaullt Option Attributes dropdown is selected with 12 but the QT Pro Option Dropdown remains deselected.
Attaching screenshot.
It shows both QTPro Option dropdown on top and default Option/Attribute below it.
Screenshot 2022-05-27 at 11-25-24 Shiny Red Apples Phoenix1.0.8.14Phoenix1.0.8.14.png
Please can you help fix the issue.
Thank you in advance...
Regds./
radhavallabh
radhavallabh
VIP Member
VIP Member
Posts: 366
Joined: Tue Oct 27, 2020 4:09 am
Contact:

Re: Option not selecting on return from shopping cart

by raiwa » Fri May 27, 2022 3:28 pm

This feature is not supported for now in QtPro. I'll have a look and maybe implement it in the next update.
If you wish to try it on your own, have a look into the core module how it is made there.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1208
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: Option not selecting on return from shopping cart

by radhavallabh » Sat May 28, 2022 6:09 am

raiwa wrote:This feature is not supported for now in QtPro. I'll have a look and maybe implement it in the next update.
If you wish to try it on your own, have a look into the core module how it is made there.
I checked the core module dear
Actually it differs completely from qtpro -As the options are being pulled from system/override/qtpro/.... file in qtpro where as the options are build in the core module in the modules/content/products/cm_products_options_attributes.php

So could you guide me if the tpl file which holds the html code for retrieving the option needs to matched or the array build file cm_products_options_attributes.php needs to be matched for fixing it?

Thank you again in advance;
Awaiting your valuable reply;
Regds./
radhavallabh
radhavallabh
VIP Member
VIP Member
Posts: 366
Joined: Tue Oct 27, 2020 4:09 am
Contact:

Re: Option not selecting on return from shopping cart

by raiwa » Sat May 28, 2022 7:07 am

The relevant code in cm_products_attributes.php is line 55-57:

Code: Select all

          'selection' => is_string($_GET['products_id'])
                       ? $_SESSION['cart']->contents[$_GET['products_id']]['attributes'][$option_id] ?? ''
                       : '',
So for the QtPro multiple drop down and stocked option you need to apply this in:
includes\system\override\qtpro\pad_multiple_dropdowns.php line 101 change to:

Code: Select all

              $selection = is_string($_GET['products_id'])
                           ? $_SESSION['cart']->contents[$_GET['products_id']]['attributes'][$attributes[$o]['oid']] ?? ''
                           : $attributes[$o]['default'];
              $out .= (new Select('id[' . $attributes[$o]['oid'] . ']', array_values($attributes[$o]['ovals']), ['id' => 'option' . $attributes[$o]['oid'], 'onchange' => 'stkmsg(this.form);']))->set_selection($selection)->require();
If you have unstocked options, you'll need to apply this also at least in:
includes\system\override\qtpro\pad_base.php line 200

The other QtPro options would need more complicate modifications which can't be addressed within this support thread.

best wishes
Rainer
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1208
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: Option not selecting on return from shopping cart

by radhavallabh » Sat May 28, 2022 7:54 am

raiwa wrote:The relevant code in cm_products_attributes.php is line 55-57:

Code: Select all

          'selection' => is_string($_GET['products_id'])
                       ? $_SESSION['cart']->contents[$_GET['products_id']]['attributes'][$option_id] ?? ''
                       : '',
So for the QtPro multiple drop down and stocked option you need to apply this in:
includes\system\override\qtpro\pad_multiple_dropdowns.php line 101 change to:

Code: Select all

              $selection = is_string($_GET['products_id'])
                           ? $_SESSION['cart']->contents[$_GET['products_id']]['attributes'][$attributes[$o]['oid']] ?? ''
                           : $attributes[$o]['default'];
              $out .= (new Select('id[' . $attributes[$o]['oid'] . ']', array_values($attributes[$o]['ovals']), ['id' => 'option' . $attributes[$o]['oid'], 'onchange' => 'stkmsg(this.form);']))->set_selection($selection)->require();
If you have unstocked options, you'll need to apply this also at least in:
includes\system\override\qtpro\pad_base.php line 200

The other QtPro options would need more complicate modifications which can't be addressed within this support thread.

best wishes
Rainer
Thank you so much dear!!
I made the given changes to both the files and it is working like a charm for now!!
Will await for the update eagerly.. :)
Very Warm Regds./
radhavallabh
radhavallabh
VIP Member
VIP Member
Posts: 366
Joined: Tue Oct 27, 2020 4:09 am
Contact: