Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/splashsync/splashsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public function install()
// Register Module Products Attributes Hooks
if (!$this->registerHook('actionObjectCombinationAddAfter') ||
!$this->registerHook('actionObjectCombinationUpdateAfter') ||
!$this->registerHook('actionObjectCombinationDeleteAfter')
!$this->registerHook('actionObjectCombinationDeleteAfter') ||
!$this->registerHook('actionProductAttributeUpdate')
) {
return false;
}
Expand Down
30 changes: 30 additions & 0 deletions modules/splashsync/src/Objects/Product/HooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,36 @@ public function hookActionObjectCombinationDeleteAfter(array $params): bool
);
}

/**
* This hook is called when a Product Combination is updated through the legacy
* Product::updateAttribute() path (used by StoreCommander and other bulk catalog
* tools), which does NOT trigger actionObjectCombinationUpdateAfter. We rebuild
* the Combination object and forward it to the standard combination commit.
*
* @param array $params
*
* @return bool
*/
public function hookActionProductAttributeUpdate(array $params): bool
{
$idProductAttribute = isset($params['id_product_attribute'])
? (int) $params['id_product_attribute']
: 0;
if ($idProductAttribute <= 0) {
return true;
}
$combination = new Combination($idProductAttribute);
if (!\Validate::isLoadedObject($combination) || empty($combination->id_product)) {
return true;
}

return $this->hookactionCombination(
$combination,
SPL_A_UPDATE,
$this->l('Product Variant Updated on Prestashop')
);
}

/**
* This hook is called after a customer effectively places their order
*
Expand Down