s07e01 - Wishlist / Faves QUESTIONS/SUPPORT

Open to all! Ask other shopowners for help.
Post Reply
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: s07e01 - Wishlist / Faves

Post by ecartz »

radhavallabh wrote: Fri Feb 18, 2022 6:55 am But does not work on 1.0.8.12 can you please guide me on what change needs to be made that is hindering it from working??
In 1.0.8.12, the only thing that I changed was stuff in PayPal files. And I can see no reason why the wishlist page would be affected by PayPal files.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: s07e01 - Wishlist / Faves

Post by radhavallabh »

ecartz wrote: Fri Feb 18, 2022 8:01 am
radhavallabh wrote: Fri Feb 18, 2022 6:55 am But does not work on 1.0.8.12 can you please guide me on what change needs to be made that is hindering it from working??
In 1.0.8.12, the only thing that I changed was stuff in PayPal files. And I can see no reason why the wishlist page would be affected by PayPal files.
@ecartz @Kofod95
Sorry for not doing more detailed debugging previously, It could have saved more of your precious time.

I think I know the confusion part now dear-
I tested a item on 1.0.8.11 without attributes- example the Green Tomatoes- Removing and To Cart works perfectly on wishlist
I tested a item on 1.0.8.11 with attributes- example the Shiny Red Apples- Removing and To Cart does not work on wishlist

I tested a item on 1.0.8.12 without attributes- example the Green Tomatoes- Removing and To Cart works perfectly on wishlist
I tested a item on 1.0.8.12 with attributes- example the Shiny Red Apples- Removing and To Cart does not work on wishlist
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: s07e01 - Wishlist / Faves

Post by Kofod95 »

My bad!
I never thought to test it with any product with attributes, when I initially went through all of them.
I can confirm, that adding a product with attributes to the wishlist does save the selection, but none of the buttons (remove, add to cart, add all to cart) works for the product with attributes, though it still works for all other products.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: s07e01 - Wishlist / Faves

Post by ecartz »

Kofod95 wrote: Fri Feb 18, 2022 12:30 pm I can confirm, that adding a product with attributes to the wishlist does save the selection, but none of the buttons (remove, add to cart, add all to cart) works for the product with attributes, though it still works for all other products.
Is that a new issue (since I changed it) or an old issue? If new, what changed?
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: s07e01 - Wishlist / Faves

Post by Kofod95 »

ecartz wrote: Fri Feb 18, 2022 2:53 pm Is that a new issue (since I changed it) or an old issue? If new, what changed?
The 1.0.8.0-version works on 1.0.7.12 and up to (at least) 1.0.8.0, and the wishlist handles products with attributes as expected: adds them to cart when asked to do so and remove from wishlist when asked to do so.

A lot of changes in includes/actions/wishlist_options.php, where the replacement for

Code: Select all

if(tep_has_product_attributes($pid)){
which is

Code: Select all

$product = product_by_id($pid);
        if (!$product || ($product->get('has_attributes') === '1')){
would be my first guess.

The other differences I can see is the removed $parameters under the global declaration (not sure if that would affect this or not) and the shift to \Product::build_uprid from tep_get_uprid. The entire line:

Code: Select all

$_SESSION['cart']->add_cart($_GET['products_id'], $_SESSION['cart']->get_quantity(tep_get_uprid($pid, $attributes)) + 1, $attributes);
to this:

Code: Select all

$_SESSION['cart']->add_cart($_GET['products_id'], $_SESSION['cart']->get_quantity(\Product::build_uprid($pid, $attributes)) + 1, $attributes);
in the two add-to-cart action-files.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: s07e01 - Wishlist / Faves

Post by ecartz »

I'm not asking about changes in the code. Installed, what is different about the new version from the old version? What changed in the actual buttons that are produced? I.e. if you look at the HTML, what changed in the HTML? Or if the difference was when it was added to the wishlist, what changed about that process? What changed in the things that are visible to you but not me?

I ask in part, because I don't think that the code to which you are pointing is used at all. Nothing ever generates a wishlist_options action. That's not new. And I don't see that the processing is different in wishlist_add. I find it rather more likely that something changed in the product listing, since the various actions all show in the wishlist product listing. Or that something changed on the product info page that changes how it was added to the wishlist at all.
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: s07e01 - Wishlist / Faves

Post by radhavallabh »

ecartz wrote: Sat Feb 19, 2022 1:02 am I'm not asking about changes in the code. Installed, what is different about the new version from the old version? What changed in the actual buttons that are produced? I.e. if you look at the HTML, what changed in the HTML? Or if the difference was when it was added to the wishlist, what changed about that process? What changed in the things that are visible to you but not me?

I ask in part, because I don't think that the code to which you are pointing is used at all. Nothing ever generates a wishlist_options action. That's not new. And I don't see that the processing is different in wishlist_add. I find it rather more likely that something changed in the product listing, since the various actions all show in the wishlist product listing. Or that something changed on the product info page that changes how it was added to the wishlist at all.
Hi dear cm_w_product_listing.php related to the attributes

Previous version we had-

Code: Select all

  function execute() {
      if ($_SESSION['wishlist']->count_contents() > 0) {
        $content_width = MODULE_CONTENT_W_PRODUCT_LISTING_CONTENT_WIDTH;
        
        $GLOBALS['any_out_of_stock'] = false;
        $products = $_SESSION['wishlist']->get_products();
        $products_field = '';

        for ($i=0, $n=count($products); $i<$n; $i++) {
          // Push all attributes information in an array
          foreach (($products[$i]['attributes'] ?? []) as $option => $value) {
            $products_field .= tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
            $attributes = tep_db_query(sprintf(<<<'EOSQL'
SELECT popt.*, poval.*, pa.*
 FROM products_options popt
   INNER JOIN products_attributes pa ON pa.options_id = popt.products_options_id
   INNER JOIN products_options_values poval
     ON pa.options_values_id = poval.products_options_values_id
    AND popt.language_id = poval.language_id
 WHERE pa.products_id = %d
   AND pa.options_id = %d
   AND pa.options_values_id = %d
   AND popt.language_id = %d
EOSQL
              , (int)$products[$i]['id'], (int)$option, (int)$value, (int)$_SESSION['languages_id']));
            $attributes_values = tep_db_fetch_array($attributes);

            $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
            $products[$i][$option]['options_values_id'] = $value;
            $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
            $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
            $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
          }
        }

        $tpl_data = [ 'group' => $this->group, 'file' => __FILE__ ];
        include 'includes/modules/content/cm_template.php';
      }
    }
In new Version it is-

Code: Select all

function execute() {
      if ($_SESSION['wishlist']->count_contents() > 0) {
        $content_width = MODULE_CONTENT_W_PRODUCT_LISTING_CONTENT_WIDTH;

        $GLOBALS['any_out_of_stock'] = false;
        $products = $_SESSION['wishlist']->get_products();
        $form = new Form('list', $GLOBALS['Linker']->build('wishlist.php', ['action' => 'wishlist_update']));

        foreach ($products as $product) {
          // Push all attributes information in an array
          foreach (($product->get('attribute_selections') ?? []) as $option => $value) {
            $form->hide('id[' . $product->get('id') . '][' . $option . ']', $value);
          }
        }

        $tpl_data = [ 'group' => $this->group, 'file' => __FILE__ ];
        include 'includes/modules/content/cm_template.php';
      }
    }
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: s07e01 - Wishlist / Faves

Post by ecartz »

That is the PHP code. I have that. It's easy for me to see what changed there. I don't need any help there.

I'm talking about the HTML that appears in your browser. What changed in that?
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: s07e01 - Wishlist / Faves

Post by radhavallabh »

ecartz wrote: Sat Feb 19, 2022 4:02 am That is the PHP code. I have that. It's easy for me to see what changed there. I don't need any help there.

I'm talking about the HTML that appears in your browser. What changed in that?
As per my deduction There is no change in the html appearance dear after cross checking.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: s07e01 - Wishlist / Faves

Post by Kofod95 »

I did feel a little silly trying to find it in the PHP, knowing that you would do that much better and quicker than me - I misunderstood :lol:

I'll look at the HTML as well next time I'm at the PC to see if I catch something

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply