Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('../AmazonApi.php');
- require_once ('../app/Mage.php');
- Mage::app();
- //Create API access object
- $public_key = '*************';
- $secret_key = '*************';
- $associate_tag = '**********-21';
- $amazon_api = new AmazonAPI($public_key, $secret_key, $associate_tag);
- $products = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('asin')
- ->addAttributeToSelect('description');
- //Array of request parameters
- foreach($products as $product)
- {
- $asin = $product->getAsin();
- $product->setDescription($response);
- $product->getResource()->saveAttribute($product, 'description');
- $params_array = array(
- 'Operation' => 'ItemLookup',
- 'IdType' => 'ASIN',
- 'ItemId' => $asin ,
- 'ResponseGroup' => 'Tracks');
- // returns a list of items for the search query 'Slow Magic'
- $response = $amazon_api->sendRequest($params_array);
- foreach ($response as $restponse)
- {
- sleep(1);
- }
- echo '<pre>';
- print_r($response);
- echo '</pre>';
- }
- foreach($parsed_xml->OperationRequest->Errors->Error as $error){
- echo "Error code: " . $error->Code . "rn";
- echo $error->Message . "rn";
- echo "rn";
- }
- $product->setDescription($response);
- $product->save();
- $product->setDescription($response);
- $product->getResource()->saveAttribute($product, 'description')
- $products = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('asin')
- ->addAttributeToSelect('description')
- ->load($productId);
- $products = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('asin')
- ->addAttributeToSelect('description');
Advertisement
Add Comment
Please, Sign In to add comment