private function _setProductData(array $aAPIResponseProductData, $sASIN, $sLocale, $iCacheDuration) { // Check if a customer review exists. $_bCustomerReviewExists = $this->_hasCustomerReview($aAPIResponseProductData); if ($_bCustomerReviewExists) { AmazonAutoLinks_Event_Scheduler::getCustomerReviews($this->getElement($aAPIResponseProductData, array('CustomerReviews', 'IFrameURL'), ''), $sASIN, $sLocale, $iCacheDuration); } $_aRow = $this->_formatRow($aAPIResponseProductData, $sASIN, $sLocale, $iCacheDuration, $_bCustomerReviewExists); $_oProductTable = new AmazonAutoLinks_DatabaseTable_product(AmazonAutoLinks_Registry::$aDatabaseTables['product']); $_iObjectID = $_oProductTable->setRowByASINLocale($sASIN . '_' . strtoupper($sLocale), $_aRow); }
/** * * @callback action aal_action_api_get_customer_review */ public function doAction() { $_aParams = func_get_args() + array(null); $_aArguments = $_aParams[0] + array(null, null, null, null); $_sURL = $_aArguments[0]; $_sASIN = $_aArguments[1]; $_sLocale = $_aArguments[2]; $_iCacheDuration = $_aArguments[3]; $_oHTTP = new AmazonAutoLinks_HTTPClient($_sURL, $_iCacheDuration); $_sHTMLBody = $_oHTTP->get(); if (!$_sHTMLBody) { return; } $_aRow = $this->_formatRow($_sURL, $_sHTMLBody, $_iCacheDuration, $_oHTTP->getCharacterSet()); if (empty($_aRow)) { return; } $_oProductTable = new AmazonAutoLinks_DatabaseTable_product(AmazonAutoLinks_Registry::$aDatabaseTables['product']); $_iSetObjectID = $_oProductTable->setRowByASINLocale($_sASIN . '_' . strtoupper($_sLocale), $_aRow); }