How add custom field in cart and sent in the order - magento

I have one question about shopping. I need aggregate one field Giftwrapped your order? Yes No. name=giftwrap id=giftwrap value=functionevalue(Radio) this validation is javascript and function, no problem with this. Now i have take the value giftwrap and send to group ajax and show this value in checkout review before confirm order, and then send the comment: the gift should be wrapped in the orden in the backend. I try, i search but no nothing functioned, please help.

Take a look at this Order Attributes extensions. It does exactly what you want for a relative cheap cost.

Related

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.

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.

Magento: Prove customer checked terms and condition checkbox

Does anybody know if there is prove or a log that a customer checked the terms and conditions box at the checkout page? We need this for our payment provider to prove that the customer has checked the box.
Hope someone can give us this answer.
Kind regards
No. Logging the checkbox state is not standard with Magento and would need to be implemented using 3rd party customizations.
The proof can be based on the fact that they placed the order. If the Terms & Condition checkbox is required, the only way for them to proceed to place the order would be to check the box.

Increase shipping price and/or add line item for extra cost

I'm implementing a custom FedEx integration solution for a Magento site. Part of this is to add a signature requirement checkbox in the onepage checkout, and add $3 if this is checked. Unfortunately it seems that the FedEx Rate Web Service doesn't take any parameter regarding signature requirements, so I must manually add this cost to the order.
I was thinking about taking one of these two approaches, but I'm not sure will be best nor am I sure how to actually accomplish it:
Add $3 to whatever price FedEx returns
Create a new line item for this
Assuming that I have a handle on the $order, which solution would be best and how would I do it?
The code should run inside an observer method which is called by the checkout_controller_onepage_save_shipping_method event, which is triggered immediately after $this->getOnepage()->saveShippingMethod($data);. This means I can't add $3 when the FedEx API returns a result, as I won't know if the checkbox is checked until afterwards.
I came up with a solution; it's not the best but it works perfectly fine for me:
Magento fires an event when saving the shipping info. I grab the POST data and save it in the db as well as the address object.
If the checkbox has changed, have it reload that same tab instead of moving onto the payment step.
In the shipping quote, check the address object for the checkbox value. If set, add a certain amount to the quote result.

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