Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

xcart5 module intergration

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 11-23-2017, 03:58 AM
 
nivetha nivetha is offline
 

Newbie
  
Join Date: Nov 2017
Posts: 8
 

Default 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.
__________________
nivetha
Reply With Quote
  #2  
Old 11-26-2017, 10:34 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 11-28-2017, 02:42 AM
 
nivetha nivetha is offline
 

Newbie
  
Join Date: Nov 2017
Posts: 8
 

Default 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... */ }
__________________
nivetha
Reply With Quote
  #4  
Old 11-29-2017, 05:10 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 11-29-2017, 12:00 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #6  
Old 11-29-2017, 08:42 PM
 
nivetha nivetha is offline
 

Newbie
  
Join Date: Nov 2017
Posts: 8
 

Default 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
Reply With Quote
  #7  
Old 11-30-2017, 01:20 AM
 
nivetha nivetha is offline
 

Newbie
  
Join Date: Nov 2017
Posts: 8
 

Default 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
Reply With Quote
  #8  
Old 12-04-2017, 04:44 AM
 
nivetha nivetha is offline
 

Newbie
  
Join Date: Nov 2017
Posts: 8
 

Default Re: xcart5 module intergration

Hi,

Please give the update .
__________________
nivetha
Reply With Quote
  #9  
Old 12-06-2017, 12:00 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:20 PM.

   

 
X-Cart forums © 2001-2020