Easify Forums

Forums -> ECommerce & Developers Discussion

 Getting the Woocommerce Plugin to use "Our SKU" instead of the Easify Sku

Post Reply
Page 1 of 1 1
Posted by Greg

Getting the Woocommerce Plugin to use "Our SKU" instead of the Easify Sku

Hi Guys,

I am trying to get the woocommerce plugin to work with our sku instead of the easify sku. Whatever I try it still seems to reference the easify sku see below from error log:

(

[EntityName] => ProductStockLevelChanged

[KeyValue] => 100791

[Action] => Modified

[PrivateKey] =>

[NotificationId] => 4146

)

02-04-21 08:59:28.48180 - Easify_Generic_Web_Service->process_request() - Entity:ProductStockLevelChanged Action:Modified Key:100791

02-04-21 08:59:28.48205 - Easify_Generic_Web_Service.UpdateProductStockLevel(100791) - doesn't exist

02-04-21 08:59:40.33118 - Easify_WC_Plugin.receive_from_easify() /wp-admin/edit.php?post_type=shop_order

02-04-21 08:59:44.40583 - Easify_WC_Plugin.receive_from_easify() /wp-admin/edit.php?post_type=shop_order

02-04-21 08:59:52.74448 - Easify_WC_Plugin.receive_from_easify() /wp-admin/edit.php?post_type=product

02-04-21 09:00:00.94647 - Easify_WC_Plugin.receive_from_easify() /wp-admin/edit.php?s=anchor&post_status=all&post_type=product&action=-1&seo_filter&readability_filter&product_type&stock_status&paged=1&action2=-1

02-04-21 09:00:50.35290 - Easify_WC_Plugin.receive_from_easify() /wp-admin/edit.php?s=anchor&post_status=all&post_type=product&action=-1&seo_filter&readability_filter&product_type&stock_status&paged=1&action2=-1

02-04-21 09:01:23.48820 - Easify_WC_Plugin.receive_from_easify() /clientaarea.php

02-04-21 09:01:24.59202 - Easify_WC_Plugin.receive_from_easify() /

02-04-21 09:01:25.84731 - Easify_WC_Plugin.receive_from_easify() /clientaarea.php

02-04-21 09:01:51.67597 - Easify_WC_Plugin.receive_from_easify() /product-category/cake-and-craft/page/6

02-04-21 09:01:54.00672 - Easify_WC_Plugin.receive_from_easify() /product-category/cake-and-craft/page/6/

02-04-21 09:02:44.77363 - Easify_WC_Plugin.receive_from_easify() /robots.txt

02-04-21 09:02:45.34432 - Easify_WC_Plugin.receive_from_easify() /product/coffee-subscription/

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

This line "[KeyValue] => 100791" Is the bit I need to fix. But trying to find where to edit the KeyValue to change it so it references the "Our SKU" column in Easify is proving to be challenging for me.

Any advice would be greatly recieved!

Greg

Posted by Darius

Re: Getting the Woocommerce Plugin to use "Our SKU" instead of the Easify Sku

Hi Greg,

The key value received by the plugin from Easify will always be the Easify SKU, but you can use this to retrieve the rest of the product details from Easify and pull out the Our Sku value that you want.

You will need to make some changes to the Easify plugin...

In class-easify-wc-shop.php add the following function:

public function get_easify_our_sku_from_easify_sku($sku) {

try {

$product = $this->easify_server->GetProductFromEasify($sku);

return $product->OurStockCode;

} catch (Exception $e) {

Easify_Logging::Log("Easify_WC_Shop.get_easify_our_sku_from_easify_sku() - " . $e->getMessage() . "\n");

}

}

and in class-easify-generic-web-service.php change the code in process_request() as follows:

if ($this->easify_entity_name == 'ProductStockLevelChanged') {

// Change product stock level...

$ourSku = $this->shop->get_easify_our_sku_from_easify_sku($this->easify_key_value);

if ($this->shop->IsExistingProduct($ourSku)) {

// update existing product

Easify_Logging::Log("Easify_Generic_Web_Service.UpdateProductStockLevel(" . $ourSku . ")");

$this->shop->UpdateProductStockLevel($ourSku);

} else {

// product doesn't exist, log error message

Easify_Logging::Log("Easify_Generic_Web_Service.UpdateProductStockLevel(" . $ourSku . ") - doesn't exist");

}

}

PS. The above code change in class-easify-generic-web-service.php only gives an example of handling product stock level changes, you would need to make these changes wherever the plugin is using the Easify SKU.

HTH

Post Reply
Page 1 of 1 1

Easify Website V 4.35    © 2024 Easify Ltd ® All rights reserved.     Privacy Policy