Punchout catalogue with nodes - cxml

I need to create an punchout enabled catalogue.
The end result should be following:
Customer should be able to see my site as a supplier in Ariba.
He visits the supplier website from within Ariba and add items to the shopping cart.
Punchout the items back to Ariba and place and order in Ariba.
I am having a hard time figuring out the steps for cXML integration with my site.

You’ll need to add functionality to your application to receive a cXML PunchOutSetupRequest XML document and send back a cXML PunchOutOrderMessage to Ariba. See this page for more details: https://punchoutcommerce.com/guides/punchout/cxml-punchout-setup-request/

Related

note passed in as part of CreateCheckoutRequest, but where to on the payment page or the dashboard to view them?

I am using nodeJs, and I have passed in note inside CreateCheckoutRequest, however, i am not seeing the note showing on the payment page url generated by createCheckout or the dashboard page.
My ultimate goal is our frontend can pass in the phone number as note to sqaure-connect, so that we can view the phonenumber from our dashboard once the customer completes an order
Tried to look at old transactions, since we didnt use note, didnt see any note.
const checkout = SquareConnect.CreateCheckoutRequest.constructFromObject({
idempotency_key: 'sample_key,
order: orderRequest,
redirect_url: redirect_url,
ask_for_shipping_address: true
note, // need to see it from dashboard once the user completes an order
});
When adding a note to a CreateCheckout request, it will end up on the tenders->note field of the associated transaction. To clarify, once the customer has paid on the checkout page, it should redirect to your web page (based on your redirect_url field that you passed to CreateCheckout originally). From there, the url will contain a parameter called transaction_id. You can then use this id to retrieve the transaction and digging into it to find the note (transaction->tenders[0]->note). In this particular use case, there will always only be one tender since Checkout doesn't allow multiple tenders.
Now, to actually answer your question: the tender note will be displayed as the main text you see when you view your transactions. So when you login to your Square Dashboard and click Transactions, in the main list, the "header" will be whatever the tender note was.

What code should I add (and where) on my website to track events/identify users on my website using segment.com?

I want to configure segment.com properly on my site and use it to manage all other apps/tools. I already installed the segment javascript on my site and used it as the source. Now, I am pushing these to MixPanel, Facebook, Google Analytics, etc.
What code should I add if I want to track an event and/or identify a user?
For simplicity's sake, i have a landing page (site.com/landing-page) with a form. After a successful submission, it redirects to a thank you page (site.com/thank-you-page).
The default settings already track the page views, and are pushing that same event to the different tools (FB: PageView, MixPanel: Loaded a Page, etc).
But in this case, i want to track the event and capture the person's information. And i don't know what to code to add and where.
My research so far
According to this article:
The best way to track new users is in client-side javascript on the welcome page after they signup, below we’ll explain why.
So, based on that, I add the code to my thank you page. But where? Header like adding GA scripts? body tag? I can add it anywhere, but i don't know where.
Next is what code should I add?
The example from the same article above:
When a new visitor goes to their site that visitor is anonymous. As soon as the visitor connects their Facebook account, Rdio knows who they are and creates a user record.
As part of that new user record the person is assigned a userId. Let’s say the new userId is 12345. Rdio will then need to fire the following calls on the welcome page:
analytics.identify('12345',{ name:'Jake Peterson', email:'friends#segment.com'});
analytics.track('Account Created',{ authentication:'Facebook'})
This gives me two problems: track and identify.
Track Problem
I'll start with the track. Based on how I understood this, assuming the event name i want to be added is "Downloaded PDF" then I want to store the title of it as well. It should look like this, right?
<script>
analytics.track('Downloaded PDF', {
title: 'Awesome Title'
});
</script>
Am I correct to enclose them inside <script> tags?
The tracking of an event seems a bit easier to understand that the identify part. But would love to know if i got that part right.
Identify Problem
Here, i have two questions:
where does userId come from? Is it automatically generated? For example, inside my MixPanel account, i see them. Is that what i use?
How do i reference to the userId? or any of the other traits I want to track in my code?
Taking from the same example above:
analytics.identify('12345',{ name:'Jake Peterson', email:'friends#segment.com'});
If i add this exact code on my thank you page, every signup will be assigned those values: '12345', 'Jake Peterson', and 'friends#segment.com', right?
What code should I add to (1) assign them the right userId (2) and get the name and email traits from the form of the previous page.
Let's say i'm only collecting first name and email.
analytics.identify("userId"{ firstName:"firstName", email:"email"});
If I add this code to my thank you page, will it automatically assign the userId, firstName, email values of the form that was submitted? That's the part I don't understand. What code to add to dynamically push the correct data.
And i know i'm not even adding the Alias part for MixPanel yet, but i just want to understand this part and the rest (hopefully) will be easier to understand.

Restful URL After Insert

I am new to RESTful URLs and I have a general question. Let's say I have a URL that I use to retrieve student records: somesite.com/students/123 which retrieves the details for the student with ID 123.
I then do the following to load an empty form for adding students: somesite.com/students/0 where zero indicates that I want to display an empty student detail form (or somesite.com/students/new).
The question I have is that after I add a student record I get back a new Id. However, if I add the record using AJAX without submitting and refreshing the page, my URL still shows somesite.com/students/0. If a user clicks refresh then the empty form is displayed again rather than the new student record.
How should that be handled?
It's not like your server can't respond to AJAX requests, right?
All you need to do is send back the newly generated ID, and then:
Use window.location = 'new_url' to redirect the user
Or even better, use history.pushState() (if available) to change the URL without any redirection (and reloading) happening at all
One thing that seems off, though, is the use of GET page/students/0 to get an "empty record", or, as I understand it, a "template" for new records. I don't think that's how RESTful services work, but then again, I'm not an expert in REST services.

Price selector from online store

I want to extract the price of certain product from banggood (i.e. http://www.banggood.com/Wholesale-IMAX-B6-Digital-RC-Lipo-NiMH-battery-Balance-Charger-p-46220.html) using google spreadsheets.
Right now I can grab the price but also other values using this string:
=IMPORTXML(A6 ; "//*[contains(#class, 'now')]")
I get this:
21.68
Buy it now
I just want to get the actual value that is within this:
<div class="now" oriprice="21.68">363.69</div>
it should be the "353.69" alone, (that's the price in mi currency , MX).
I also tried this:
=IMPORTXML(A6 ; "//*[contains(#class, 'now')] and string('oriprice')")
but returns TRUE not the value
Any help would be appreciated.
21.68 is actually a correct result.
When you do scraping you should always consider real server response, but not what you see on scree.
So go to source and see real HTML. See picture below (that is the page u mentioned)
and reason why u get Buy Now is
So write this
=IMPORTXML(A6 ; "//*[#class = 'now']")
The reason you get 21.68 is because that's the price in US dollars, which appears to be the site's base currency.
When you View Source, as Dmytro suggests, you might see a different value in the div containing the price. I see 14.26, for example, because that's the price in my currency.
This value is being updated after the page has been loaded. That page's Javascript is detecting your country, setting a cookie with your currency in it, and then making an AJAX call to this page:
http://www.banggood.com/index.php?com=product&t=initViewHistory&utm_medium=&product_id=46220
That is returning an HTML snippet with the price in your own currency, which the main page's Javascript is then inserting into the page.
Your problem, as far as the spreadsheet goes, is that when you use Google Sheets to fetch that page (a) Google Sheets won't run the Javascript and (b) Google's request to the store's site will probably be detected as being in the US and so even if the JS were run it wouldn't actually change the price.

Is it possible to show the order details sent to customer via email in a separate page (Magento)?

Is it possible to show the order details of last processed order, such as
Item Sku Qty Subtotal
in a separate page?
I tried adding the order details section from frontend/base/default/template/email/order/items/order/default.phtml in a separate cms page, by adding {{layout handle="sales_email_order_items" order=$order}} to it.
But, when I run this cms page after order being placed, it shows the following error:
Fatal error: Call to a member function getAllItems() on a non-object in D:\wamp\www\magento\app\design\frontend\base\default\template\email\order\items.phtml
Is this actually possible?
This is possible.. its already present in the magento system, when user places an order successfully they are shown with order number and a link to order details page.
the link to order page is like http://www.example.com/sales/order/view/order_id/25/
we can make system to be redirected directly to this page to accomplish this task.
the only this we needed is the order id this can be get using
Mage::getSingleton("checkout/session")->getLastOrderId();
Yes, most things are possible. You'd have to write your own module, with your own controller which would serve up your own template. There you can load up an order and display whatever you want.
Obviously, that isn't the answer you are hoping for, but your question isn't specific, and writing out how to accomplish what you want could easily take an entire blog article.

Resources