This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AUTHORIZATION : Bearer QkEAARgyi3MPFsmP8St6L2Yc07DkYKQRt5MNo/7caN75haGqDTFDNH/meyYIpKa19Qt1rw== | |
| X_XC_MESSAGE_GUID : f72b7e90-f7ee-4964-901b-6e2427a7c680 | |
| X_XC_PUBLISHER : TUQAAXOrYY3iyGbbL6IvNPGWJMaw4CrLBE7QTXIUFuJgo6gBIWPrCwOkXfhMLTbOJXAepw== | |
| X_XC_SCHEMA_URI : https://ocl.xcommercecloud.com/marketplace/profile/deleted/1.0.0 | |
| X_XC_SCHEMA_VERSION : 1.0.0 | |
| X_XC_TENANT_ID : VEkAAalGt+ye8hDbMXeh8BAquNa72oifsoQNEtjQ9mTzZ8czA7M0+AcJQvDVVsN51DUgNw== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #XFabric properties | |
| xfabric.endpoint=https://api.sandbox.x.com/fabric | |
| xfabric.message.content.type=avro/binary | |
| #capability emulator properties | |
| emulator.port=9090 | |
| emulator.tenant.token=<PUT EMULATOR SPECIFIC TENANT BEARER TOKEN HERE> | |
| #Enduser(test) capability - aka scratchpad - properties | |
| scratchpad.port=9091 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Based and modified from | |
| //http://www.idriss.us/web-development/php/programmatically-creating-products-magento-14x/ | |
| // This function gets product information from the Google product search site using the supplied API key and query string | |
| function getGoogleProducts($apikey, $query) | |
| { | |
| // model URL - https://www.googleapis.com/shopping/search/v1/public/products/?key=KEY&q=QUERY&country=US | |
| $url = "https://www.googleapis.com/shopping/search/v1/public/products/?key=".$apikey."&q=".$query."&country=US"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <config> | |
| <modules> | |
| <Xcommerce_Cse> | |
| <active>true</active> | |
| <codePool>local</codePool> | |
| <version>0.1.0</version> | |
| </Xcommerce_Cse> | |
| </modules> | |
| </config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <config> | |
| <modules> | |
| <Xcommerce_Cse> | |
| <version>0.1.0</version> | |
| </Xcommerce_Cse> | |
| </modules> | |
| <global> | |
| <models> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Xcommerce_Cse_AdminController extends Mage_Adminhtml_Controller_Action | |
| { | |
| public function indexAction() | |
| { | |
| $this->loadLayout() | |
| ->_addContent($this->getLayout()->createBlock('cse/listProducts')) | |
| ->renderLayout(); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Xcommerce_Cse_Block_ListProducts extends Mage_Core_Block_Template | |
| { | |
| protected function _toHtml() | |
| { | |
| $message = Mage::helper('cse/data')->generateAvroCseMessage(); | |
| // Initialize a cURL session | |
| $ch = curl_init(); | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include_once 'avro.php'; | |
| class Xcommerce_Cse_Helper_Data extends Mage_Core_Helper_Abstract | |
| { | |
| public function generateAvroCseMessage() { | |
| $collection = Mage::getModel('catalog/product') | |
| ->getCollection() | |
| ->addAttributeToSelect('*'); | |
| $cse_product_details = array(); | |
| foreach ($collection as $p) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //get schema for ping | |
| $schema_uri = "https://api.x.com/ocl/message/ping/1.0.0"; | |
| $content = file_get_contents($schema_uri); | |
| $schema = AvroSchema::parse($content); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $schema_uri = $headers['X-XC-SCHEMA-URI']; | |
| //deserialize the data | |
| $content = file_get_contents($schema_uri); | |
| $schema = AvroSchema::parse($content); | |
| $datum_reader = new AvroIODatumReader($schema); | |
| $read_io = new AvroStringIO($post_data); | |
| $decoder = new AvroIOBinaryDecoder($read_io); | |
| $message = $datum_reader->read($decoder); |