Jump to content

Can't delete generated product combination


pasha23

Recommended Posts

  • 4 weeks later...

I am having this same problem.  I tried emptying the cache and it didn't help.  I will select an attribute for my product, click on the trash can icon, I confirm to delete in the pop up window, but the combination is still there.  

Link to comment
Share on other sites

First of all, please inform which Prestashop version are you using ? Which php-version are you using ?

 

Are you using Varnish on server (ask provider) ? If yes than you should change your hosting package or disable this on server (this can be done only by server admins). Varnish is an external cache, which is not compatible with Prestashop.

Link to comment
Share on other sites

Did you try a different browser/computer? Sometimes such problems are cookie related.

 

Did you look in your server log file? There might be some error message.

 

I could have a look but for that I would need access to both the backoffice and the database.

Link to comment
Share on other sites

  • 1 year later...
  • 3 weeks later...
  • 3 months later...
  • 1 year later...
  • 9 months later...
  • 1 year later...
On 6/29/2017 at 9:59 AM, selectshop.at said:

First of all, please inform which Prestashop version are you using ? Which php-version are you using ?

 

Are you using Varnish on server (ask provider) ? If yes than you should change your hosting package or disable this on server (this can be done only by server admins). Varnish is an external cache, which is not compatible with Prestashop.

Also want to know about it.

Edited by mican (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Hi.

The problem arises when product editing is open and the page is refreshed, or the changes are not saved. As for editing the product, everything is saved in the cache and everything can be loaded back when the page is refreshed.
How to do it ?
Delete the combinations by clicking on the trash can icon, wait for the message that everything is saved and then exit the product editing.
If there are many combinations and you need to delete them all, the fastest way is to delete them from the database either with an SQL query or a script.
The difference is then considerable.

Link to comment
Share on other sites

E.g:

 obrazek.png.969945f95840ad5952cbcc77cdc2da6b.png 

/*uncomment <?php*/
    /* delete product all combinations SAMPLE */
 
    include_once ('./config/config.inc.php');

    $startTime = microtime(true);

    /* change 1 to your id_product */
    $idProduct = 1; 
    
    $getAttributes = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.$idProduct);
    $attributesArray = array();
    $cnt = 0;

    if ($getAttributes) {

        foreach ($getAttributes as $attr) {
            $attributesArray[] = $attr['id_product_attribute'];
        }

        $cnt = count($attributesArray);
        $attributesToDelete = implode(',', $attributesArray);

        /* DELETE FROM product_attribute_combination */ 
        Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_product_attribute IN ('.$attributesToDelete.')');
        
        /* DELETE FROM product_attribute_image */
        Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_attribute_image WHERE id_product_attribute IN ('.$attributesToDelete.')');

        /* DELETE FROM product_attribute */
        Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_attribute WHERE id_product_attribute IN ('.$attributesToDelete.')');

        /* DELETE FROM product_attribute_shop */
        Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_attribute_shop WHERE id_product_attribute IN ('.$attributesToDelete.')');

        /* DELETE FROM stock_available */
        Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'stock_available WHERE id_product_attribute IN ('.$attributesToDelete.') AND id_product = '.$idProduct);

        /* SET DEFAULT CACHE Attribute */
        Db::getInstance()->execute("UPDATE "._DB_PREFIX_."product SET cache_default_attribute = '0' WHERE id_product = ".$idProduct);
        Db::getInstance()->execute("UPDATE "._DB_PREFIX_."product_shop SET cache_default_attribute = '0' WHERE id_product = ".$idProduct);

        /* CLEAN cache */
        Tools::clearSmartyCache();
        Tools::clearXMLCache();
        Media::clearCache();
        Tools::generateIndex();

        $endTime = microtime(true);
        $totalTime = round(($endTime - $startTime), 2);

        echo 'DONE all combinations are deleted.<br>Combinations count: '.$cnt.'<br>Total in (seconds): '.$totalTime;
    } else {
        $endTime = microtime(true);
        $totalTime = round(($endTime - $startTime), 2);
        echo 'ERROR deleting combinations.<br>Total in (seconds): '.$totalTime;
    }

 

Link to comment
Share on other sites

  • 3 months later...

This solved it on our side:

Plesk, PHP settings for host with Prestashop install, Run PHP as on FPM application served by nginx (NL: PHP uitvoeren als op FPM-toepassing bediend door nginx)

if you have access to PHP settings please try that if you are on NGINX. Sorry I don't have explenation for this configuration.

Link to comment
Share on other sites

  • 8 months later...

s Varnish being utilized on your server? If it is, I recommend reaching out to your hosting provider to discuss either upgrading your hosting package or disabling Varnish on the server. Varnish is an external caching system, and it's not compatible with Prestashop. Server administrators are the ones who can perform this task.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

Embarking on a business transformation? Navigate the process seamlessly with our guide on IRS Change of Business Name at Lawyers Corner! 🌐 Ensure a smooth transition and avoid pitfalls when updating your business name for tax purposes. Empower your journey with expert insights and strategic advice. Ready to redefine your business identity? Visit Lawyers Corner now and let our legal expertise be your guide. Your business evolution starts here

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...