Update special price promotion
Use the UpdateSpecialPricePromotion method to modify promotion at a special price.
Request parameters
Parameters
Type / Description
promotionCode
Required (string)
Code of the promotion that you want to update.
sessionID
Required (string)
Unique identifier of the session.
existingPromotion
Required (string)
Details of the existing promotion.
PriceMatrix
Required (array of objects)
Only for this type of promotion. It is generated by getPriceMatrix and used to set promotion special prices.
Request sample
<?php
require ('PATH_TO_AUTH');
// Retrieve promotion details
$promotionCode = 'PROMOTION_CODE'; // code of the promotion that you want to update
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getPromotion',
'params' => array($sessionID, $promotionCode)
);
//var_dump (callRPC((Object)$jsonRpcRequest, $host));
// Keep the promotion you want to update in $existingPromotion
$existingPromotion = callRPC((Object)$jsonRpcRequest, $host);
// Set the fields to update
$priceMatrixDefinition1 = new stdClass;
$priceMatrixDefinition1->ProductCode = "test";
$priceMatrixDefinition1->PricingConfigurationCode = "738C6A2049";
$priceMatrixDefinition1->OptionHash = "708e43960c4edc42f14cf388bcb24bde";
$option1 = new stdClass;
$option1->GroupName = "Units";
$option1->OptionText = "1 - maximum";
$price1 = new stdClass;
$price1->Value = 20;
$price1->Currency = "USD";
$price2 = new stdClass;
$price2->Value = 15;
$price2->Currency = "EUR";
$priceMatrixDefinition1->Options = [$option1];
$priceMatrixDefinition1->Prices = [$price1, $price2];
$existingPromotion->DefaultCurrency = 'USD';
$existingPromotion->PriceMatrix = [\
$priceMatrixDefinition1\
];
// Update the promotion
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updatePromotion',
'params' => array($sessionID, $existingPromotion)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));Response
Last updated
Was this helpful?