header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Catalog Product Tag

Edit this page on GitHub

Module: Tag

Allows you to operate with product tags.

Resource: catalog_product_tag

Aliases: product_tag

Methods:
Faults:
Fault Code Fault Message
101 Requested store does not exist.
102 Requested product does not exist.
103 Requested customer does not exist.
104 Requested tag does not exist.
105 Provided data is invalid.
106 Error while saving tag. Details in error message.
107 Error while removing tag. Details in error message.
Example:
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
$productId = 2;
$customerId = 10002;
$store = 'default';

// Add tags
$data = array('product_id' => $productId, 'store' => $store, 'customer_id' => $customerId, 'tag' => "First 'Second tag' Third");
echo "Adding Tag... ";
$addResult = $proxy->call(
    $sessionId,
    "product_tag.add",
    array($data)
);
echo ((count($addResult) == 3) ? "Done!" : "Fail!");
echo "<br />";
print_r($addResult);
$tagId = reset($addResult);

// Get tag info
echo "<br />Get Tag Info (id = $tagId)... ";
$infoResult = $proxy->call(
    $sessionId,
    "product_tag.info",
    array($tagId, $store)
);
echo "Done!<br />";
print_r($infoResult);

// Update tag data
$data = array('status' => -1, 'base_popularity' => 12, 'name' => 'Changed name');
echo "<br />Update Tag (id = $tagId)... ";
$updateResult = $proxy->call(
    $sessionId,
    "product_tag.update",
    array($tagId, $data, $store)
);
echo ($updateResult ? "Done!" : "Fail!");

// Retrieve list of tags by product
echo "<br />Tag list for product with id = $productId... ";
$listResult = $proxy->call(
    $sessionId,
    "product_tag.list",
    array($productId, $store)
);
echo (count($listResult) ? "Done!" : "Fail!");
echo "<br />";
print_r($listResult);

// Remove existing tag
echo "<br />Remove Tag (id = $tagId)... ";
$removeResult = $proxy->call(
    $sessionId,
    "product_tag.remove",
    array($tagId)
);
echo ($removeResult ? "Done!" : "Fail!");
Create the Magento file system owner