X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   xcart5 module intergration (https://forum.x-cart.com/showthread.php?t=75819)

nivetha 11-23-2017 03:58 AM

xcart5 module intergration
 
Hi,

I have created a module to recover the abandoned cart in xcart version 4.6.6 gold and xcart4.7.7 gold. Its working fine. Now i'm trying to do the same in xcart 5.3.3.4.
I need to put the server side code at the payment page. Earlier in xcart 4 version i have added the code in the path ( >>payment >> payment_offline.php ) and its working. So please help me to find the path to add the code.

qualiteam 11-26-2017 10:34 PM

Re: xcart5 module intergration
 
Coding for X-Cart 5 is completely different than doing the same for X-Cart 4.

Here is the documentation for X-Cart 5 developers:
https://devs.x-cart.com/

Also, there are two "abandoned cart reminder" ready-made modules for X-Cart 5.
Are you sure that developing a new module from the scratch will cost you less than buying one of these?

nivetha 11-28-2017 02:42 AM

xcart5 module intergration
 
in 5.3.3.4

1.I used this script in home page for displaying the siteid(k5BcYFhK)

<script data-siteid="k5BcYFhK" src="https://api.domain.com/js/customer-tracking/dev104.trackingdomain.comxcart53x_9d1d6.js" type="text/javascript">
</script>


2.I used this script in cart page for displaying the add to cart products
<script type="text/javascript">
//set cart total value
_cartstack.push(['setCartTotal', '{{ this.getTotalValue() }}']);
</script>


<script type="text/javascript">
//loop through items in cart and include here

{% for stackcart in this.getCartStack() %}


_cartstack.push(['setCartItem', {
'quantity':'{{ stackcart.getAmount() }}',
'productID':'{{ stackcart.getItemId() }}',
'productName':'{{ stackcart.getName() }}',
'productDescription':'{{ stackcart.getDescription() }}',
'productURL':'{{ stackcart.getURL() }}',
'productImageURL':'{{ stackcart.getImageURL() }}',
'productPrice':'{{ stackcart.getPrice() }}'
}]);
{% endfor %}
</script>

3.this is my question ?

Here is my code which i had used in xcart 4.6 & 4.7 version payment section. Please help me , where i need to use the code in xcart 5.3.3.4 version


// Setup the URL
$emailAddress = $userinfo['email'];

// required, get from session or db...
$cartTotal = $cart['total_cost']; // optional, more accurate reporting...
$url =
&quot;https://api.domaiin.com/ss/v1/?key=6cc64f627ae94113&amp;siteid=k5BYYFZK&amp;e
mail=&quot;.$emailAddress.&quot;&amp;total=&quot;. $cartTotal;

// Initialize cURL...
$ch = curl_init();

// Set URL and Return directives...
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Send the request...
$jsonResponse = curl_exec($ch);

// Close cURL...
curl_close($ch);

// Handle JSON response...
$response = json_decode($jsonResponse, true);

// Successful call is response code 100...
if ($response['resp'] != &quot;100&quot;)
{ /* Handle error responses, see &quot;Response Codes&quot; above... */ }

tony_sologubov 11-29-2017 05:10 AM

Re: xcart5 module intergration
 
@nivetha,

What kind of code do you want to put to the payment page? I mean, what is this code supposed to do?
Once I grasp the idea, I would be able to suggest about where to put your code in X-Cart 5.

Tony

tony_sologubov 11-29-2017 12:00 PM

Re: xcart5 module intergration
 
Quote:

Originally Posted by nivetha
3.this is my question ?

Here is my code which i had used in xcart 4.6 & 4.7 version payment section. Please help me , where i need to use the code in xcart 5.3.3.4 version


// Setup the URL to CartStack...
$emailAddress = $userinfo['email'];

// required, get from session or db...
$cartTotal = $cart['total_cost']; // optional, more accurate reporting...
$url =
&quot;https://api.cartstack.com/ss/v1/?key=6cc64f627ae9418b820a41891dce6b13&amp;siteid=k 5BYYFZK&amp;e
mail=&quot;.$emailAddress.&quot;&amp;total=&quot;. $cartTotal;

// Initialize cURL...
$ch = curl_init();

// Set URL and Return directives...
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Send the request...
$jsonResponse = curl_exec($ch);

// Close cURL...
curl_close($ch);

// Handle JSON response...
$response = json_decode($jsonResponse, true);

// Successful call is response code 100...
if ($response['resp'] != &quot;100&quot;)
{ /* Handle error responses, see &quot;Response Codes&quot; above... */ }


When do you want to run this code? Once I know that, I can suggest where to put this code in.

Tony

nivetha 11-29-2017 08:42 PM

Re: xcart5 module intergration
 
hi,
In xcart4.7 i use this below code in path ( >>payment >> payment_offline.php )


$emailAddress = $userinfo['email'];

// required, get from session or db...
$cartTotal = $cart['total_cost']; // optional, more accurate reporting...
$url =
&quot;https://domain.com/ss/v1/?key=6cc64f627ae9418b820a41891dce6b13&amp;siteid=k 5BYYFZK&amp;e
mail=&quot;.$emailAddress.&quot;&amp;total=&quot;. $cartTotal;

// Initialize cURL...
$ch = curl_init();

// Set URL and Return directives...
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Send the request...
$jsonResponse = curl_exec($ch);

// Close cURL...
curl_close($ch);

// Handle JSON response...
$response = json_decode($jsonResponse, true);

// Successful call is response code 100...
if ($response['resp'] != &quot;100&quot;)
{ /* Handle error responses, see &quot;Response Codes&quot; above... */ } it is working

in 5.3 where i use this code please mention the file path and give a some guidins

nivetha 11-30-2017 01:20 AM

Re: xcart5 module intergration
 
Hi,

Actually, when an order is placed successfully, we want to pass the order ID and order total to our own backend system (We have the API called using CURL method).

So, in 4.7.x, we have used it in Payment page when an order is placed successfully and we placed the code and it worked.

Pls advise us how to achieve this in Version 5.3.x

nivetha 12-04-2017 04:44 AM

Re: xcart5 module intergration
 
Hi,

Please give the update .

qualiteam 12-06-2017 12:00 AM

Re: xcart5 module intergration
 
I believe it is \XLite\Model\Order::processSucceed() that you are looking for.
You should decorate this method from your custom module and put your custom logic after calling the parent's one.


All times are GMT -8. The time now is 05:03 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.