• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 22.04.20, 19:56
  • Opened by: Peter Michalik
  • Closed by: Fred
  • Closed on: 23.06.20, 23:28
  • Reason: Closed
  • Comment: Glad to help!

Ticket #17465 - Product Miniature showing shoe sizes (based on defined Features) even when sizes are out of stock

Hello

Shoe sizes are shown with product miniature on category page (see image below) even though specific sizes are out of stock in their respective combinations:

Product combinations defined as in the image below:

We will require NOT TO SHOW such shoe sizes where stock is zero.

Regards, Peter

Attachments:

shoe-sizes.png (69.9 KiB)
shoe-combinations.png (78.7 KiB)

Comments

Fred 23 Apr 2020, 10:39

There is no such option. We have to customize this feature to make it work as you like

Peter Michalik 23 Apr 2020, 12:52

Thank you, can you please do it? It doesn’t make sense to show to the cutomer something that is not available. This was a primary reason why we purchased the theme and verified this unctionality upfront multiple times.

Fred 23 Apr 2020, 20:40

we have huge ticket number last days. Please remind me about that within a week, maybe we will have time

Peter Michalik 24 Apr 2020, 11:29

for this particular case, next week is OK

Fred 24 Apr 2020, 11:33

ok

Peter Michalik 29 Apr 2020, 10:32

Hi Fred, let me know when you can start working on this. You mentioned sometimes this week

Fred 29 Apr 2020, 10:36

I need access to modules files on your server

Peter Michalik 29 Apr 2020, 12:58

ok, which folder exactly. is it this one?

/obuvtopky.sk/web/themes/alysum/modules
Fred 29 Apr 2020, 13:07

no, /obuvtopky.sk/web/modules/

Peter Michalik 29 Apr 2020, 13:20

again, we need to use parent-child principle here as nothing should be changed is /obuvtopky.sk/web/modules/.

can you please work in child folder where you have access.

/obuvtopky.sk/web/themes/alysumchild/modules/

Regards, Peter

Fred 30 Apr 2020, 11:20

it’s impossible. I need to edit .php files. but in the directory /alysumchild/modules/ only .tpl files are allowed

Peter Michalik 30 Apr 2020, 19:04

Hi Fred, I granted you privileges to the folder

/obuvtopky.sk/web/modules/ 

please use this account to access, passwords and server stay the same as defined in my profile here

alysum.modules.obuvtopky.sk

please create a backup copy of each file before editing with suffix

*.BACKUP-ALYSUM-TOPKY

Please acknowledge this.

Fred 01 May 2020, 11:31

still don’t see “modules” folder.
But we fixed this issue and it will be available in the next update

Peter Michalik 01 May 2020, 20:20

Fred, have you tried signing in with alysum.modules.obuvtopky.sk username (it’s different!)? I granted access to modules root folder for that username. when will be next template release available to upgrade?

Fred 02 May 2020, 10:11

Now it has to work as you asked. Updated file is /pk_themesettings/pk_themesettings.php

Peter Michalik 05 May 2020, 12:08

Hello Fred, thank you but this is NOT ACCEPTABLE solution because changes will be lost with next theme update. I reverted your changes in root module folder /modules/pk_themesettings/pk_themesettings.php

I checked that you changed only one function. Can you please implement the changes into child theme directory for this function only:

  public function hookDisplayProductListReviews($params)
  {
    if((!isset($this->context->controller->php_self) || !in_array(Tools::strtolower($this->context->controller->php_self), array('category','search','manufacturer','supplier','new-products','prices-drop','best-sales','index'))))
        return false;

    if(!$params || !isset($params['product']))
        return false;

    $product = new Product($params['product']['id_product'], false);
    if (!Validate::isLoadedObject($product))
        return false;

    $groups = array();
    $attributes_groups = $product->getAttributesGroups($this->context->language->id);

    if (is_array($attributes_groups) && $attributes_groups)
    {
      foreach ($attributes_groups as $k => $row)
      {
        if (
            isset($config['pm_attr']) && (@$config['pm_attr'] != $row['id_attribute_group']) ||
            $row['quantity'] == 0
          ) {
            continue;
          }

        if (!isset($groups[$row['id_attribute_group']]))
            $groups[$row['id_attribute_group']] = array(
                'name' => $row['public_group_name'],
                'group_type' => $row['group_type'],
                'default' => -1,
            );

        $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name'];

        if (!isset($groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']])) {
          $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
        }
        $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int)$row['quantity'];
        $groups[$row['id_attribute_group']]['attributes_id'][$row['id_attribute']] = (int)$row['id_product_attribute'];

        if ($row['group_type']=='color'){
          $texture = '';
          if (Tools::isEmpty($row['attribute_color']) && @filemtime(_PS_COL_IMG_DIR_.$row['id_attribute'].'.jpg')) {
              $texture = $this->context->link->getMediaLink(_THEME_COL_DIR_.$row['id_attribute'].'.jpg');
          }
          $groups[$row['id_attribute_group']]['colors'][$row['id_attribute']] = array(
            'type' => $texture ? 1 : 0,
            'value' => $texture?:$row['attribute_color'],
          );
        }
      }
      
      $this->context->smarty->assign(array(
          'pk_list_groups' => $groups
      ));
      return $this->fetch('module:'.$this->name.'/views/templates/hook/front.tpl');
    }
  }
Fred 05 May 2020, 14:36

it’s impossible. we can only override .tpl files with child theme

Peter Michalik 06 May 2020, 10:05

is there any other solution? how about using directory:

/web/override 

I want to prevent this not working with next upgrade

Peter Michalik 22 May 2020, 17:34

Hello Fred, this stopped working and I don’t entirely know why but maybe due to forced regeneration of the theme.

Can you please implement permanent solution into child theme as requested originally? Many thanks.

Fred 22 May 2020, 18:18

for some reason .js files won’t override modules original files, you can try yourself

Peter Michalik 22 May 2020, 22:11

yes but I don’t know why. I didn’t do anything with JS. can it be that a version of blog module which you recommended in one of the threads has caused some problems?

Fred 23 May 2020, 10:29

It should work fine. and captcha also works in blog demo.
Try to make a fix yourself.
- Open the file /modules/ph_simpleblog/views/js/ph_simpleblog-17.js
- remove the line 102 https://take.ms/k4uqW

Peter Michalik 24 May 2020, 12:00

Hello Fred, this stopped working and I don’t entirely know why but maybe due to forced regeneration of the theme.

Can you please implement permanent solution into child theme as requested originally? Many thanks.

Fred 24 May 2020, 12:25

what stopped working?

Peter Michalik 24 May 2020, 13:25

Solution proposed on 23 May 2020, 08:29 is in place but doesn’t work. Shoe sizes are shown with product miniature on category page (see image below) even though specific sizes are out of stock in their respective combinations.

You can check with any random product that doesn’t have defined she size (combination) but stock 0.

Can you please implement a solution in alysumchild directory or overrides directory so it’s permanent and works after next upgrade. many thanks

Fred 25 May 2020, 10:51

But you know what file I have updated /pk_themesettings/pk_themesettings.php and what code was changed https://take.ms/NQx8W you can do all yourself, there is only one line you have to add

Peter Michalik 27 May 2020, 18:22

hello fred - again can this be updated in the alysumchild directory, not in the main modules directory.

Fred 28 May 2020, 00:11

with the child theme possible to override only template files (.tpl) read more here https://devdocs.prestashop.com/1.7/themes/reference/template-inheritance/parent-child-feature/

Peter Michalik 28 May 2020, 10:06

can JS be placed in overrides or somewhere else?

Fred 28 May 2020, 16:49

Ye, it is

Peter Michalik 28 May 2020, 18:11

ok can you please solve by using overides or something else as you confirmed. this is still not working. many thanks.

Fred 28 May 2020, 20:09

I just changed this code https://take.ms/4ibh6 in the file /pk_themesettings/pk_themesettings.php what I already described you earlier. Now all works. Please don’t change that file, I can’t do the same work twice