AmmoSeek BigCommerce Integration: Our Expertise All Blogs Guide Integration Jun 17, 2024 5 minutes to read 700 viewsAmmoSeek is a service designed to assist sellers of hunting products, such as bullets and gunpowder, in promoting and selling their items online. If you have a BigCommerce website and wish to utilize AmmoSeek, there isn’t an existing application available in the BigCommerce Apps Catalog for integration. However, you can perform the AmmoSeek BigCommerce integration yourself.In this article:Required SkillsHow can AmmoSeek retrieve product information from your store?Steps to Generate Feed from BigCommerce ProductsPrerequisites for initiating XML Feed Generator developmentDeveloping the Feed GeneratorNeed Help with the AmmoSeek BigCommerce Integration?Required Skills:Basic experience with PHPFamiliarity with CronHow can AmmoSeek retrieve product information from your store?AmmoSeek retrieves information about available products in your store by web-scraping your data feed file. This data feed is essentially a text file containing detailed information about each item. It should be hosted on a web server, accessible to AmmoSeek at any time. For instance, the feed might be located at a URL such as http://yourdomain.com/xmlfeed.php for live feeds or http://yourdomain.com/xmlfeed.xml for feeds updated at least every 5 minutes.You can find more information about feed specifications and requirements for the AmmoSeek feed on the official website to ensure efficient AmmoSeek BigCommerce integration.Additionally, you can check out our 7-step AmmoSeek integration guide here.Steps to Generate Feed from BigCommerce Products:Retrieve Products from BigCommerce Store:Utilize the BigCommerce API or other available methods to fetch the products you want to include in the feed.Generate and Save XML Feed into File:Use PHP scripting to generate an XML feed based on the retrieved product data.Organize the XML structure according to the specifications required by AmmoSeek.Save the generated XML feed as a file on your server. You can use file handling functions in PHP to accomplish this task.Send Generated Feed to Store WebDAV:Use Cron to schedule a task that automatically transfers the generated XML feed file to your store’s WebDAV server at specified intervals.Configure the Cron job to run the script responsible for transferring the feed file.Ensure that the script includes the necessary authentication credentials and uses secure protocols (such as HTTPS) for transferring the file to maintain data integrity and security.By following these steps, you can efficiently generate a feed from your BigCommerce products, save it to a file, and send it to your store’s WebDAV server for AmmoSeek integration.Prerequisites for initiating XML Feed Generator developmentStore API KeyFirstly, we need to gain access to your Store API. We’ll retrieve information about available products from the API and proceed to create the feed.You can generate a new API key for Store-level access from within the BigCommerce Store Settings page.Prerequisites for initiating xml feed generator developmentPlease create a new API key with the following scopes:Scope:Products: Read-onlyAfter generating the API key, remember to save the generated Client ID, Client Secret, and Access Token for future use.Store hash:Follow the URL in your browser’s address bar when your BigCommerce Store Admin Panel is open. You should see a link similar to this:Where the URL starts with “store-XXXXXX…”, the “XXXXXX” values represent your unique store hash. Make sure to save it for reference as well.WebDAV CredentialsOnce the feed file is generated, we’ll need to place it on a web server where AmmoSeek can access and retrieve it. An easier solution for us is to upload the feed file directly to your store’s file system. To do this, navigate to the Settings page and then select File access (WebDAV).And make sure to save the generated values for:WebDAV PathWebDAV UsernameWebDAV PasswordDeveloping the Feed GeneratorFor developing this generator, you can utilize any programming language. In our case, we used PHP version 8 along with Composer. Additionally, our project will incorporate the following Composer libraries:aligent/bigcommerce-api-client: This library facilitates working with the BigCommerce API version 3.aaronddm/xml-builder: Used for constructing the XML feedSabre/dav: Utilized for uploading files into WebDav.Project Initialization:Create a new folder for your project.Inside the project folder, run the command composer require aligent/bigcommerce-api-client aaronddm/xml-builder Sabre/dav.After running the command, your project folder will contain the following files and directories:composer.jsoncomposer.lockVendor/You can then create a starter index.php file with an autoloader and save the changes.<?php require_once 'vendor/autoload.php';Once the project initialization is complete, you can begin developing your feed generatorIf you experience any issues with the AmmoSeek BigCommerce integration, contact us today, and our experts will assist you promptly.Retrieve products for the feed.You can create an object to handle API interactions with BigCommerce using the following code:$bigCommerce = new \BigCommerce\ApiV3\Client( $storeHash, // Store hash obtained from previous steps $apiClientID, // Client ID obtained from previous steps $apiAccessToken // Access token obtained from previous steps );Then, you can obtain a list of products using the following code:$products = $bigCommerce->catalog()->products()->getAllPages([ 'inventory_level:min' => 1, // Show only available products in stock 'is_visible' => true, // Show only visible products 'availability' => 'available', // Show only available products ]);Here, you can refine your list of products by applying more accurate filters based on categories and other attributes. You can explore the full list of available filters in the BigCommerce Dev Center.Generating an XML FeedBefore you begin, ensure to review the official requirements outlined by AmmoSeek and verify that your products include all the mandatory fields required for the chosen product type.To initiate the feed generation process, you’ll need to create an object with the feed generator using the following code:$feedGenerator = new \AaronDDM\XMLBuilder\XMLBuilder( new \AaronDDM\XMLBuilder\Writer\XMLWriterService() );You can commence generating your feed by iterating through your products using a foreach loop. Below is a minimalistic example code to demonstrate how it can be done:$xmlArray = $feedGenerator->createXMLArray(); $xmlArray->startLoop('productlist', ['retailer' => 'Link to your store'], function (XMLArray $XMLArray) use ($products) { foreach ($products as $product) { $XMLArray->start('product') ->add('type', 'powder') ->addCData('title', $product->name) ->addCData('url', $product->url) ->addCData('brand', $product->brand) // Add other fields as needed ->end(); } })->end();For fields that may contain special characters such as “&”, we’ll utilize the `addCData` method to properly escape them.Save your feed locally:Once the feed is created as an object, you can save it locally using the following code:$file = fopen("my-amoseek-feed.xml", "w"); fwrite($file, $feedGenerator->getXML()); fclose($file);Send the local file to WebDAV.:First, you need to create an object for WebDAV manipulations:$webDav = new \Sabre\DAV\Client\Client([ 'baseUri' => 'WebDAV Path', 'userName' => 'WebDAV Username', 'password' => 'WebDav Password', ]);And upload your feed file to the remote server using the following code:$response = $webDav->request('PUT', '/content/my-feed.xml', file_get_contents('my-amoseek-feed.xml'))That’s all! If you’ve followed the steps correctly and tailored this example to fit your business requirements, your script should run successfully. You can then access your feed at the following path: https://yourstore.com/content/my-feed.xmlSchedule Script ExecutionTo meet AmmoSeek’s requirements, you must update your feed at least once every 5 minutes. You can achieve this by configuring a cron job with a launch rule, for example, every 5 minutes: */5 * * * *.Need Help with the AmmoSeek BigCommerce Integration?AmmoSeek integration with your BigCommerce store can be a complex and time-consuming process. At Deveit, we offer expert assistance at every step. Contact us today, and our team will handle this AmmoSeek integration for you.Share Prev All Blogs Next Contact us Our expert team is here to help. Submit your details and we will contact you within 24 hours Name* Phone Email* Message*