RealTimeDesigner Support Network
Wiki Forums Libraries Docs Support RealTimeDesigner Home
Welcome! Log In Create A New Profile

Advanced

RTD Woocommerce 3.x Plugin updates

Posted by Alex 
RTD Woocommerce 3.x Plugin updates
August 04, 2017 03:12AM
Hello everyone,

We know we had not been very active in the forum in the latest months, but this does not mean we're on hold: a lot of things happened outside of here!
Simply put, a lot of RTD users are no more asking for core RTD modifications, but a lot of custom coding for altering the regular RTD behavior as well as heavy integration coding projects.
For this, the vast majority of our activity is now happening via support tickets to handle such requests.

One of the more frequent topic is actually related to RTD/Woocommerce integration.
The ones of you making use of it know that we suggested not to upgrade to the new Woocommerce 3.x brand, as it was known to have pricing issues with the RTD plugin.

I am now here to annouce that's solved, and it actually was easier than expected!
The version that's handling it is 1.5.8.
So, if you have the plugin and would like to update your Woocommerce plugin, there are 2 main possible things to do:

1, in case you are using a vanilla version of our plugin:
In this case, just open a support ticket in your RTD admin panel, specify which version of the plugin you currently have and ask for the new one to be provided

2, in case you made modification to the plugin or you had a project with us to modify it:
In this case a direct upgrade is obviously not possible, or custom modifications would be lost.
Compared to the 1.5.7 version of the plugin, only few things had been changed. Details are:

in function add_rtd_product_to_cart, replace this:
if (isset($parsed_data["RTD_REPLY"]["ITEM_UNITPRICE_INCLUDEADDONS_".$i]) && $parsed_data["RTD_REPLY"]["ITEM_UNITPRICE_INCLUDEADDONS_".$i]>0) {
	$rtd_value=$parsed_data["RTD_REPLY"]["ITEM_UNITPRICE_INCLUDEADDONS_".$i];
}
if (isset($parsed_data["RTD_REPLY"]["ITEM_SUBSIZES_".$i]) && strlen($parsed_data["RTD_REPLY"]["ITEM_SUBSIZES_".$i])>0) {
	$rtd_value=number_format($parsed_data["RTD_REPLY"]["ITEM_TOTALPRICE_INCLUDEADDONS_".$i]/$rtd_qty , 4,'.','');
}
with this:
if (isset($parsed_data["RTD_REPLY"]["ITEM_TOTALPRICE_INCLUDEADDONS_".$i]) && strlen($parsed_data["RTD_REPLY"]["ITEM_TOTALPRICE_INCLUDEADDONS_".$i])>0) {
	$rtd_value=number_format($parsed_data["RTD_REPLY"]["ITEM_TOTALPRICE_INCLUDEADDONS_".$i]/$rtd_qty , 2,'.','');
}

in function realtimedesigner_set_custom_price, replace this:
$value['data']->price = $rtd_data['rtd_item_price'];
with this:
$value['data']->set_price($rtd_data['rtd_item_price']);

in function realtimedesigner_order_item_name, replace this:
if (!empty($item['rtd_data'])) $rtd_data=unserialize($item['rtd_data']);
with this:
if (!empty($item['rtd_data'])) {
	if (is_array($item['rtd_data'])) {
		$rtd_data=$item['rtd_data'];
	} else {
		$rtd_data=unserialize($item['rtd_data']);
	}
}

in function realtimedesigner_order_details, replace this:
if (!empty($item['rtd_data'])) $rtd_data=unserialize($item['rtd_data']);
with this:
if (!empty($item['rtd_data'])) {
	if (is_array($item['rtd_data'])) {
		$rtd_data=$item['rtd_data'];
	} else {
		$rtd_data=unserialize($item['rtd_data']);
	}
}

This pretty much will do it, and will correctly pass prices to Woo even in version 3.x. At the end, the main issue was caused by the Woo function price being replaced by another one named set_price, and some internal unserialization now performed automatically.

If this will be enough for you to fix your version, then just go for it. If you will need help and custom coding then you'll have to go through a new support ticket to discuss the project.

That's all for now!
Sorry, only registered users may post in this forum.

Click here to login