Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ShipStation Shipping Integration Software


greasemonkey

Recommended Posts

Hey all, while working on a new project to connect my store with Amazon I came across an ecommerce shipping integration software called ShipStation.

And realized quickly during my 30 day trial - this is something HUGE missing from OsC.... Wow... what a great program!

The ShipStation API connects to almost EVERY eCommerce platform available (both hosted and self hosted) BUT NOT WITH OSC. It even will integrate with Zencart....

It was extremely easy to integrate with Amazon... Here are just a few of the highlights in my few days using it:

1) The API connects with all major shipping carriers - including Fedex, UPS, DHL, USPS, Canada Post & Purolator.

2)The API connects to the "store" and "fetches" current orders where they can be batch printed for picking and shipping labels can be printed without data entry (other than weights and dimensions).

3) Connects to multiple store and multiple shipping carriers at the same time

4) Because the API connects with multiple carriers it can quickly and easily compare shipping rates on the fly and then print labels for ANY of the connected Carriers in seconds.... even international shipments and will even print closing (manifest) reports if required.

Just to be clear - this is not a shipping "module" to provide rates via OsC. It is a shipping automation tool to help with the "backend" stuff that our customers don't ever see - the biggest thing is, IMHO, comparing shipping rates of multiple carriers and printing shipping labels without data entry.

I have asked ShipStation if they would consider adding OsC to their platform... here is there reply...

http://feedback.shipstation.com/forums/330429-product-feedback-fresh-ideas/suggestions/20039272-oscommerce

Seriously... go forth and SPAM the hell out of them requesting integration!!!!!

Anyone who ships more than a few orders a day....needs access to this!

Link to comment
Share on other sites

I have all ready replied to the mod...

Quote

Thank you for the update. OsCommerce is an open source software - so I would recommend joining the OsC community forums to connect with those at OsC that can help with the integration... https://www.oscommerce.com/forums/forum.

The most current version code base can be found here: https://github.com/gburton/Responsive-osCommerce

Your developers will find OsCommerce and Zencart (which you do offer an integration for) to be of a very similar structure (some would call them almost identical).

The next version 2.4 is being developed here https://github.com/osCommerce/oscommerce2

 

Link to comment
Share on other sites

  • 3 weeks later...

@greasemonkey Scott I had a call shortly after this thread was started offering me a platform for shipping from a company that seems to be based in Toronto.  I'm not sure how it fits in with what you're working on but I thought I'd pass the information and link along in case if was of any interest to  you.

Dan

Link to comment
Share on other sites

Yes, I have briefly looked into them... and also eshipper... Neither do what shipstation does (or at least as well as shipstation does).

That said, since ShipStation doesn't seem to be an option I have put in a commercial request to build my/our own..... in an admin/hook tab here are the basics from one of my conversations with those quoting.....

----------------------------------------------------------

Currently I offer shipping quotes via Canada Post, FedEx and I'm working on Purolator (another Canadian shipping vendor). In addition to these API I also have the following modules: 1) DHL (I'm using MultiGeoZone MultiTable for this as the DHL API sucks) and 2) about 6 different flat rate modules (some which are $0.00 for free shipping or in store pick up and others flat rate depending on the location or SPPC customer group).

So first I'm looking to dramatically simplify the way I display the shipping rates for my customers (similar to the way Amazon does it) to the following: Standard, Expedited/Ground and Express (I will still use the free shipping and instore pickup modules). I'm not sure how yet I will display these rates (I may just use the current fedex or Canada post module and strip out all branding).... this should be simple and I can certainly handle this myself.

NOW from an order management process (this is where it gets complicated) - after packing each order -  weigh and measure, input the weights and measurements in the admin hook/tab to quote and compare shipping rates for Canada Post, FedEx and Purolator and possibly UPS in the future (similar to ShipStation if you have ever used it?).... Then select the cheapest method for the service level and before printing the label. The reason quite simply is... I have been using shipstation on trial and have found huge differences in the shipping rates from courier to courier for the same package to the same destination on the same service level. To make this all work however I need 100% accurate shipping quotes and the only way to accomplish this is with weights AND dimensions after the order has been packed.

The Canada Post module has dimensional support built in (although we do NOT use it.... with almost 4000 sku's it is really impossible to manage) so forwarding the LxWxH should be easy. The FedEx and Purolator mods do not have built in dimensional support ... however both API's will accept LxWxH.... as long as $length, $width, $height $weight (entered in the admin) mean the same thing in each.... we should be able to get a 100% accurate quote from each....

I know what I'm trying to accomplish - just not sure if I can verbalize the process.

Link to comment
Share on other sites

Ship Station is awesome! I had it integrated into an ERP. The awesome thing was using it as a quarterback, unlike the traditional thought of an ERP should be the quarterback. Shipstation had done a lot of the leg works. I was gonna write the OSC integration module, but not enough time right now. Ship station don't make money from the monthly fee, they make money from the percentage of your shipping bill. They were bought by Stamps.com last year.

Link to comment
Share on other sites

11 hours ago, clustersolutions said:

Ship Station is awesome! I had it integrated into an ERP. The awesome thing was using it as a quarterback, unlike the traditional thought of an ERP should be the quarterback. Shipstation had done a lot of the leg works. I was gonna write the OSC integration module, but not enough time right now. Ship station don't make money from the monthly fee, they make money from the percentage of your shipping bill. They were bought by Stamps.com last year.

I wonder if, in stead of trying to have my own ship station (admin hook tab) programmed I would  be better off to have someone do a custom ShipStation integration (this is an option..... they do allow this....)??????????

Link to comment
Share on other sites

Ok reading through ShipStations very well documented integration info - they offer 2 "levels" of integration: a "Custom Store Integration" and the "ShipStation API".

Reading the docs the Custom Store Integration would DEFINITELY be easier to accomplish however still well be beyond my skill level... end results are:

Provide order information to ShipStation, including recipient address, products, customers, etc.... which ShipStation can then be used to print shipping labels and... send back tracking information when an order is shipped, including shipping method, shipping status, tracking number, and more

The ShipStation API allows FULL order management:

Managing Orders, Managing Shipments, Creating Shipping Labels, Retrieving Shipping Rates and more!!!

I'm now leaning towards a the Custom Store Integration....

For those interested here are the development guidelines: https://app.shipstation.com/content/integration/ShipStationCustomStoreDevGuide.pdf

Link to comment
Share on other sites

Ok mini break through guys, I have stripped apart the zencart connector (a job that I had already started but had give up) that ShipStation has and have it communicating (with a bunch of errors of course) with the  "Custom Store Integrator". 

I'll keep you posted  

 

Link to comment
Share on other sites

@greasemonkey, of course they do. In fact all you need is an account, then you can get your API/secret keys to make the API calls. The API blue print that they offer is good. Writing the app for OSC is no big deal. I think waiting for a OSC release to be comfortable to develope on is a much bigger deal. I found it funny that SS do a lot of things that an ERP would do, but it is missing a good ERP integration. Then again, I found some stores must had an "oh, shiz" moment as their multi-channels online sales were sky rocketing through the roof and SS was there to get their orders out the door--which was probably very important at first until customers start bitching about sold out or not knowing where their orders went. 

8 hours ago, greasemonkey said:

I wonder if, in stead of trying to have my own ship station (admin hook tab) programmed I would  be better off to have someone do a custom ShipStation integration (this is an option..... they do allow this....)??????????

Link to comment
Share on other sites

Ok, I have a working sample/beta of the ShipStation connector using the "custom store integration".

Anyone out there wish to help test????? Please PM me.

You will require a SS account, and an account with Fedex, UPS, Canada Post, USPS Purolator or whatever other carriers can integrate....

SS Does offer a 30 day trial at ShipStation that does NOT require a credit card....

Link to comment
Share on other sites

Just testing myself here and it would seem I have found the first issue - the below query is not looping through to get "items" for each order (it gets the items for the first order only).

I'll include the original zen_cart Execute function commented out....

        //while (!$orders_result->EOF) {
          while ($orders_result = tep_db_fetch_array($orders_query)) {			
			//modified for osc
            //get order items from datbase
            $orderitems_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $orders_result['orders_id'] . "'");
            //$orderitems_result = $db->Execute($orderitems_query);
            $orderitems_result = tep_db_fetch_array($orderitems_query);

which is put in the xml like this

            echo "\t<Items>\n";
            //process Order Items
            while ($orderitems_result = tep_db_fetch_array($orderitems_query)) {							

                $image_query = tep_db_query("SELECT products_image, products_weight FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . $orderitems_result['products_id'] . "'");
                $image_result = tep_db_fetch_array($image_query);
                echo "\t<Item>\n";
                AddFieldToXML("SKU", '<![CDATA[' . $orderitems_result['products_model']. ']]>');
                AddFieldToXML("Name", '<![CDATA[' . $orderitems_result['products_name']. ']]>');
                AddFieldToXML("ImageUrl", '<![CDATA[' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $image_result['products_image']. ']]>');
                AddFieldToXML("Weight", $image_result['products_weight']);
                AddFieldToXML("WeightUnits", 'grams');		
                AddFieldToXML("Quantity", $orderitems_result['products_quantity']);				
                AddFieldToXML("UnitPrice", round($orderitems_result['final_price'], 2));
                AddFieldToXML("Location", '<![CDATA[' . round($orderitems_result['products_location'], 2). ']]>');		

				//modified for osc
                $orderitems_attributes_query = tep_db_query("SELECT orders_products_attributes_id, products_options, products_options_values  FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . $orders_result['orders_id'] . "' and orders_products_id = '" . $orderitems_result['orders_products_id'] . "'");
                //$orderitems_attributes_result = $db->Execute($orderitems_attributes_query);
                $orderitems_attributes_result = tep_db_fetch_array($orderitems_attributes_query);

				
                if ($orderitems_attributes_result['orders_products_attributes_id']) {
                    echo "\t<Options>\n";
                }

                //while (!$orderitems_attributes_result->EOF) {
				while ($orderitems_attributes_result = tep_db_fetch_array($orderitems_attributes_query)) {					

                    echo "\t<Option><Name><![CDATA[" . $orderitems_attributes_result['products_options'] . "]]></Name><Value><![CDATA[" . $orderitems_attributes_result['products_options_values'] . "]]></Value></Option>\n";

                    //$orderitems_attributes_result->MoveNext();
                }

                if ($orderitems_attributes_result['orders_products_attributes_id']) {
                    echo "\t</Options>\n";
                }

                echo "\t</Item>\n";

                //$orderitems_result->MoveNext();
            }

            //process Order Items
            echo "\t</Items>\n";

Zencart would have used (I think)

$orderitems_result->MoveNext();

to loop.... what am I missing?

Link to comment
Share on other sites

Ok, I think I got it....

                $image_query = tep_db_query("SELECT products_image, products_weight FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . $orderitems_result['products_id'] . "'");
                $image_result = tep_db_fetch_array($image_query);
                AddFieldToXML("SKU", '<![CDATA[' . $orderitems_result['products_model']. ']]>');
                AddFieldToXML("Name", '<![CDATA[' . $orderitems_result['products_name']. ']]>');
                AddFieldToXML("ImageUrl", '<![CDATA[' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $image_result['products_image']. ']]>');
                AddFieldToXML("Weight", $image_result['products_weight']);
                AddFieldToXML("WeightUnits", 'grams');		
                AddFieldToXML("Quantity", $orderitems_result['products_quantity']);				
                AddFieldToXML("UnitPrice", round($orderitems_result['final_price'], 2));
                AddFieldToXML("Location", '<![CDATA[' . round($orderitems_result['products_location'], 2). ']]>');		
				//get attributes
                $orderitems_attributes_query = tep_db_query("SELECT orders_products_attributes_id, products_options, products_options_values  FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . $orders_result['orders_id'] . "' and orders_products_id = '" . $orderitems_result['orders_products_id'] . "'");
				while ($orderitems_attributes_result = tep_db_fetch_array($orderitems_attributes_query)) {			
                if ($orderitems_attributes_result['orders_products_attributes_id']) {
                    echo "\t<Options>\n";
                }
                    echo "\t<Option><Name><![CDATA[" . $orderitems_attributes_result['products_options'] . "]]></Name><Value><![CDATA[" . $orderitems_attributes_result['products_options_values'] . "]]></Value></Option>\n";
                if ($orderitems_attributes_result['orders_products_attributes_id']) {
                    echo "\t</Options>\n";
                }
            }

If I understand correctly I had an extra while( $orderitems_result.... and tep_db_fetch_array does the looping....

Also had to clean up the xml some more.

Now I need to test it posting the updated status back to OsC....

Link to comment
Share on other sites

Ok, I now have two way communication sending back updates with the Carrier, Service & tracking number and entering this into the comments box as an order history update.

2 questions;

1) There is no way to directly notify the customer with the return URL parameters (example of the return below):

ttps://www.yourstore.com/shipstationxml.php?action=shipnotify&order_number=ABC123&carrier=USPS&service=USPS+Priority+Mail&tracking_number=9511343223432432432 H

So, I'm going under the assumption that EVERYONE's "shipped" status is, as default "3".

Or is there a way for me to "$_get" this somehow?

2) I'm using the below to "update and insert" into the order and order status history tables - is there no way I can "NOTIFY" the customer?

    if ($_GET['order_number']) {

        $status = 3;
        $customer_notified = '0';
        $comments = $_GET['service'] . ' ' . $_GET['tracking_number'];

        $record_query = tep_db_query("SELECT orders_id FROM " . TABLE_ORDERS . " WHERE orders_id = '" . $_GET['order_number'] . "'");
        $record_result = tep_db_fetch_array($record_query);		

        if ($record_result['orders_id']) {

				tep_db_query("update " . TABLE_ORDERS . "
	                      set orders_status = '" . tep_db_input($status) . "', last_modified = now()
	                      where orders_id = '" . (int) $_GET['order_number'] . "'");

                tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
	                      values ('" . (int) $_GET['order_number'] . "',
	                      '" . tep_db_input($status) . "',
	                      now(),
	                      '" . tep_db_input($customer_notified) . "',
	                      '" . tep_db_input($comments) . "')");

        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
		AddFieldToXML("ShipNotice", 'Status updated successfully');

Of course I can change the status to notified easy enough... but could I actually add (I use HTML emails templates)?

          $customer_notified = '0';
          if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on')) {
              $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
            }

            // TODO delete refencies when page loader change
            chdir('../');
            require('includes/classes/osc_template.php');
            $oscTemplate = new oscTemplate();
            $oscTemplate->getContent('email_orders');
            chdir(DIR_FS_DOCUMENT_ROOT);
            // TODO end  
			
            $customer_notified = '1';
          }

As a backup there is a function inside the SS config to send tracking emails directly and some nice email templates to choose from... so no big deal could just change notify to "1" and be done with... however another user man be confused as to why customers are not receiving emails.....

Link to comment
Share on other sites

  • 2 weeks later...

I haven't used ShipStation and don't mean to hijack your thread, however, I thought it might be helpful to mention that ShipWorks has a OSC integration.  I've used it for years and recently upgraded OSC to 2.3.4BS Responsive and am still using ShipWorks.  I ship to the U.S. and internationally via USPS, FedEx, UPS and OnTrac and ShipWorks handles it all. 

Link to comment
Share on other sites

  • 3 months later...

Hi All, if any one is following this thread. I need some query help.

As I had mentioned I have successfully created (by editing ShipStation supported ZenCart module) a shipstation integration module for OsCommerce and I have been using it for several months. It is a HUGE money saver for us to be able to compare rates on the fly before printing labels.

Where I'm  stuck is with the main query for the orders - when there is only 1 order in the database in the pending status it will not pull the order... When there is more than one order... it works like a charm. I presume there is something wrong with the "while" (which is what I believe loops).... but I have tried and failed.

Any help?

    //get order from database
    $orders_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS . " WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");
    $orders_result = tep_db_fetch_array($orders_query);	

    if ($orders_result['orders_id']) {
        //begin outputing XML
        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
        echo "<Orders>\n";
        //process orders
          while ($orders_result = tep_db_fetch_array($orders_query)) {			
            //get order items from datbase
            $orderitems_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $orders_result['orders_id'] . "'");
           // $orderitems_result = tep_db_fetch_array($orderitems_query);

            $cust_id = $orders_result['customers_id'];
            $cust_deff_id = $orders_result['customers_default_address_id'];
            $address_query = tep_db_query("SELECT * FROM " . TABLE_ADDRESS_BOOK . " WHERE customers_id = '$cust_id' and address_book_id = '$cust_deff_id'");
            $address_result = tep_db_fetch_array($address_query);

            //billing country code
            $billing_country_id = $orders_result['billing_country'];
            $billing_query = tep_db_query("SELECT * FROM " . TABLE_COUNTRIES . " WHERE countries_name = '$billing_country_id'");
            $billing_result = tep_db_fetch_array($billing_query);
            //billing country code
            //shipping country code
            $shipping_country_id = $orders_result['delivery_country'];		
            $shipping_query = tep_db_query("SELECT * FROM " . TABLE_COUNTRIES . " WHERE countries_name = '$shipping_country_id'");
            $shipping_result = tep_db_fetch_array($shipping_query);			

            //billing zone code
            $billing_zone_id = addslashes($orders_result['billing_state']);		
            $zone_billing_query = tep_db_query("SELECT * FROM " . TABLE_ZONES . " WHERE zone_name = '$billing_zone_id'");
            $zone_billing_result = tep_db_fetch_array($zone_billing_query);			
            //billing zone code
            //shipping zone code
            $shipping_zone_id = addslashes($orders_result['delivery_state']);					
            $zone_shipping_query = tep_db_query("SELECT * FROM " . TABLE_ZONES . " WHERE zone_name = '$shipping_zone_id'");
            $zone_shipping_result = tep_db_fetch_array($zone_shipping_query);			
            //shipping zone code

            $ship_order_id = $orders_result['orders_id'];				
            $ship_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '$ship_order_id' and class = 'ot_shipping'");
            $ship_result = tep_db_fetch_array($ship_query);

            $order_total_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '$ship_order_id' and class = 'ot_total'");
            $order_total_result = tep_db_fetch_array($order_total_query);	

            $order_tax_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '$ship_order_id' and class = 'ot_tax'");
            $order_tax_result = tep_db_fetch_array($order_tax_query);				
			
            $orders_status_query = tep_db_query("select orders_status_id, orders_status_name
	                                 from " . TABLE_ORDERS_STATUS . "
	                                 where orders_status_id = '" . $orders_result['orders_status'] . "'");
            $orders_status = tep_db_fetch_array($orders_status_query);
									 
                $orders_history_query = tep_db_query("select date_added
	                                    from " . TABLE_ORDERS_STATUS_HISTORY . "
	                                    where orders_id = '" . tep_db_input($orders_result['orders_id']) . "' and orders_status_id = '" . $order_status_id . "'
	                                    order by date_added LIMIT 1");
                $orders_history = tep_db_fetch_array($orders_history_query);										

                $orders_history_comments_query = tep_db_query("select comments
	                                      from " . TABLE_ORDERS_STATUS_HISTORY . "
	                                      where orders_id = '" . tep_db_input($orders_result['orders_id']) . "' and (comments is not null or comments != '')
	                                    order by date_added LIMIT 1");
                $orders_history_comments = tep_db_fetch_array($orders_history_comments_query);											

                $shipping_comments = $orders_history_comments['comments'];

            echo "\t<Order>\n";

            //order details
            AddFieldToXML("OrderID", $orders_result['orders_id']);
		    AddFieldToXML("OrderNumber", $orders_result['orders_id']);
            AddFieldToXML("OrderDate", date('m/d/Y h:i A', strtotime($orders_result['date_purchased'])));
            AddFieldToXML("OrderStatus", '<![CDATA[' . $orders_status['orders_status_name'] . ']]>');
            AddFieldToXML("LastModified", date('m/d/Y h:i A', strtotime($orders_result['last_modified'])));
            AddFieldToXML("ShippingMethod", '<![CDATA[' . $ship_result['title'] . ']]>');					
			AddFieldToXML("PaymentMethod", '<![CDATA[' . $orders_result['payment_method'] . ']]>');
            AddFieldToXML("OrderTotal", round($order_total_result['value'], 2));
            AddFieldToXML("TaxAmount", round($order_tax_result['value'], 2));
            AddFieldToXML("ShippingAmount", round($ship_result['value'], 2));
            AddFieldToXML("CustomerNotes", '<![CDATA[' . $shipping_comments . ']]>');
            //order details
            //customer details
            echo "\t<Customer>\n";

            AddFieldToXML("CustomerCode", $orders_result['customers_id']);

            //billing details
            echo "\t<BillTo>\n";

            $billing_state = $orders_result['billing_state'];

            AddFieldToXML("Name", '<![CDATA[' . $orders_result['billing_name'] . ']]>');
            AddFieldToXML("Company", '<![CDATA[' . $orders_result['billing_company'] . ']]>');
            AddFieldToXML("Phone", $orders_result['customers_telephone']);	
            AddFieldToXML("Email", $orders_result['customers_email_address']);
			
            echo "\t</BillTo>\n";			

            echo "\t<ShipTo>\n";

            $shipping_state = $orders_result['delivery_state'];

            AddFieldToXML("Name", '<![CDATA[' . $orders_result['delivery_name'] . ']]>');
            AddFieldToXML("Company", '<![CDATA[' . $orders_result['delivery_company'] . ']]>');
            AddFieldToXML("Address1", '<![CDATA[' . $orders_result['delivery_street_address'] . ']]>');
            AddFieldToXML("Address2", '<![CDATA[' . $orders_result['delivery_suburb'] . ']]>');
            AddFieldToXML("City", '<![CDATA[' . $orders_result['delivery_city'] . ']]>');
            AddFieldToXML("State", '<![CDATA[' . $shipping_state . ']]>');
            AddFieldToXML("PostalCode", $orders_result['delivery_postcode']);
            AddFieldToXML("Country", $shipping_result['countries_iso_code_2']);
            AddFieldToXML("Phone", $orders_result['customers_telephone']);	
			
            echo "\t</ShipTo>\n";
            //shipping details

            echo "\t</Customer>\n";
            //customer details
            echo "\t<Items>\n";
            while ($orderitems_result = tep_db_fetch_array($orderitems_query)) {				
            //process Order Items
                $image_query = tep_db_query("SELECT products_image, products_weight FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . $orderitems_result['products_id'] . "'");
                $image_result = tep_db_fetch_array($image_query);
				$weight = $image_result['products_weight'];
				$weight_grams = $weight * 1000;
			
                echo "\t<Item>\n";
                AddFieldToXML("SKU", '<![CDATA[' . $orderitems_result['products_model']. ']]>');
                AddFieldToXML("Name", '<![CDATA[' . $orderitems_result['products_name']. ']]>');
                AddFieldToXML("ImageUrl", '<![CDATA[' . HTTP_SERVER . DIR_WS_CATALOG . 'images/' . $image_result['products_image']. ']]>');
                AddFieldToXML("Weight", $weight_grams);
                AddFieldToXML("WeightUnits", 'grams');		
                AddFieldToXML("Quantity", $orderitems_result['products_quantity']);				
                AddFieldToXML("UnitPrice", round($orderitems_result['final_price'], 2));
                AddFieldToXML("Location", '<![CDATA['. $orderitems_result['products_location'] . ']]>');		
				//get attributes
                $orderitems_attributes_query = tep_db_query("SELECT orders_products_attributes_id, products_options, products_options_values  FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . $orders_result['orders_id'] . "' and orders_products_id = '" . $orderitems_result['orders_products_id'] . "'");
                echo "\t<Options>\n";
				while ($orderitems_attributes_result = tep_db_fetch_array($orderitems_attributes_query)) {		
				echo "\t<Option><Name><![CDATA[" . $orderitems_attributes_result['products_options'] . "]]></Name><Value><![CDATA[" . $orderitems_attributes_result['products_options_values'] . "]]></Value></Option>\n";
				}
                echo "\t</Options>\n";
           
             echo "\t</Item>\n";
			}
            //process Order Items
            echo "\t</Items>\n";
            echo "\t</Order>\n";

        }

        //process Orders
        //finish outputing XML
        echo "</Orders>";
    }

 

Link to comment
Share on other sites

All, ok I've figured out my error....

    //get order from database
    $orders_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS . " WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");
    $orders_result = tep_db_fetch_array($orders_query);	

    if ($orders_result['orders_id']) {
        //begin outputing XML
        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
        echo "<Orders>\n";
        //process orders
          while ($orders_result = tep_db_fetch_array($orders_query)) {	

my if statement to run the loop.... that was carried forward from the old zencart module could not run without....

    $orders_result = tep_db_fetch_array($orders_query);	

Duh... so I simply changed the if statement too

    if (tep_db_num_rows($orders_query)) {		

And removed the duplicate

tep_db_fetch_array($orders_query))

I'm now all good at... I will release as an addon.

 

    //get order from database
    $orders_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS . " WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");

    if (tep_db_num_rows($orders_query)) {		
        //begin outputing XML
        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
        echo "<Orders>\n";
        //process orders
          while ($orders_result = tep_db_fetch_array($orders_query)) {		

 

Link to comment
Share on other sites

@greasemonkey

One tiny suggestion ... to match the current coding style, replace the TABLE_  references with the actual table name.

For example, from

 $orders_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS . " WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");

to

 $orders_query = tep_db_query("SELECT * FROM orders WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");

Malcolm

 

Link to comment
Share on other sites

  • 2 weeks later...
On 11/25/2017 at 3:04 PM, ArtcoInc said:

@greasemonkey

One tiny suggestion ... to match the current coding style, replace the TABLE_  references with the actual table name.

For example, from


 $orders_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS . " WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");

to


 $orders_query = tep_db_query("SELECT * FROM orders WHERE orders_id >'0' and IFNULL(last_modified, date_purchased) BETWEEN '" . $sd . "' AND DATE_ADD('" . $ed . "', INTERVAL 1 MINUTE)");

Malcolm

 

Done....

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...