Integrating Product Price By Size with Attribute Wizard Pro

If you’re using the Attribute Wizard Pro Module for Prestashop then you’ll soon find yourself running into problems with other modules which hook into Presashops cart functions. This is because Attribute Wizard Pro overrides and hijacks some of the core Prestashop cart functions.

Although it is recommended to use the native Prestashop attributes / combinations when using the Product Price by Size module for maximum compatibility, if you do really need to use the two modules together this short guide should help you get the two running alongside each other.

The code references provided in this article correspond to Product Price By Size 1.5.4 and higher.

Modifying Attribute Wizard Pro Files

We’ll be modifying the following two files:

/modules/attributewizardpro/combination_json.php
/modules/attributewizardpro/js/awp_product.js

combination_json.php

Locate the file: /modules/attributewizardpro/combination_json.php and comment the line at around 646:

$redirect = array("error" => $errors, "added" => md5(stripslashes($return)));

should be changed to:

//$redirect = array("error" => $errors, "added" => md5(stripslashes($return)));

and below this add the new line of code:

$redirect = array("error" => $errors, "added" => md5(stripslashes($return)), "ipa" => $id_product_attribute); // MP : Product Price By Size

awp_product.js

Around line number 2254, after the code below:

if (feed.error != "")
{
    alert(feed.error);
    return;
}

Add the line of code below:

ppbs.addDimensionsToCart(false, feed.ipa); // MP : Product Price By Size

All done, the above changes should allow the product price by size module to successfully add dimensions to the product being added to the cart, which may fail without the customizations above.

Leave a Reply

Your email address will not be published. Required fields are marked *