[Vtigercrm-developers] Product bundle quantity not working on vtiger 8.3

Rubén A. Estrada Orozco rulotec1 at gmail.com
Wed Mar 19 16:35:01 GMT 2025


Alexander, I think it would be best to create an issue and, if you fix it,
a MR too.

On Tue, Mar 18, 2025 at 4:58 PM Alexander Allen <alexander.allenz at gmail.com>
wrote:

> If you try to create a product bundle and you set quantity/unit like this
> image you will notice that quantity doesnt save and always sets 1.
>
> [image: imagen.png]
> I see that file modules\Products\actions\RelationAjax.php send this
> relation here:
>
> $relationModel->addRelation($sourceRecordId, $relatedRecordId,
> array('quantities' => $qtysList));
>
> but addRelation function on modules\Vtiger\models\Relation.php only
> receive two parameters: $sourcerecordId and $destinationRecordId
>
> Here are my modifications
>
> public function addRelation($sourcerecordId, $destinationRecordId, $otros
> = null) { //paaz agrega para verificar relacion
> global $adb;
> $quantity = isset($otros['quantities'][$destinationRecordId]) ?
> $otros['quantities'][$destinationRecordId] : null;
> $sourceModule = $this->getParentModuleModel();
> $sourceModuleName = $sourceModule->get('name');
> $sourceModuleFocus = CRMEntity::getInstance($sourceModuleName);
> $destinationModuleName = $this->getRelationModuleModel()->get('name');
> relateEntities($sourceModuleFocus, $sourceModuleName, $sourcerecordId,
> $destinationModuleName, $destinationRecordId);
> if($quantity) {
> $adb->pquery("UPDATE vtiger_seproductsrel SET quantity=? where productid=?
> and crmid=?", array($quantity,$sourcerecordId, $destinationRecordId));
> }
> }
>
> I modify the code to work. Have you ever found this?
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20250319/9fac7328/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imagen.png
Type: image/png
Size: 110927 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20250319/9fac7328/attachment-0001.png>


More information about the vtigercrm-developers mailing list