I've built a handler to push an order to Square system with their PHP API SDK. Everything works fine, except I cannot see where I could potentially put extra information like, shipping notes or something.
I thought the meta fields would be a kind of placeholder, but they do not show up in an order and is designed for searchability and tagging. I considered creating a line item just for notes, but then I would have to manage a product.
Is anyone else familiar their API and know if there is a place?
Related
So I am trying to set up a site on my localhost. I have selected 2 payment gateways from admin end
Online Payment (Free Shipping)
Cash On Delivery(Free Shipping/Flat COD Charge INR 50 )
Now I have customized all the rules for them. I only need one more rule.
I wish to have a functionality wherein I can enter some pincode/postcode values (through admin panel or maybe in some array in a javascript file or directly into the database, does not matter) of locations where second method is available)
Whenever someone presses continue before confirming order, the checkout form is validated so as to check from the form data if the value entered in post code matches the data (from any of the above methods) and if yes, only then they can continue or I wish to show an error message that
Following payment gateway is not available in your location
If you give me a hint on how to proceed with this, perhaps, I might be able to take it further. I am a bit or a starter in opencart so not much idea about how to proceed. I have sound knowledge of PHP, JQuery and Javascript although. So any and all help will be appreciated.
There are a few different extensions that already exist to do what you want - allow you to restrict shipping methods by various criteria. This one is my personal favorite: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=1614
I managed it with JQuery for the time being. Edited the submit function in the cart.tpl file in catalog->view->theme->ancart (theme name) ->cart folder.
Used a plugin called "Zipcode COD" to enter zipcodes. Edited the response JQuery to hide and show payment options.
Lots of hard coding but does the trick. I will post the code if someone needs.
I'm trying to show a cart icon in Drupal with the number of items in the cart of our sister Magento site.
I'm using the Magento Core API to look up information on customers and use it in Drupal. I'm trying to load the contents of the cart for a specific Magento Customer ID, but I don't see any way to do this. The cart info API method only supports look ups by quote ID. Quote ID appears to be the primary key for a cart.
Is it possible to look up cart information by customer ID with a Magento API?
You can't fetch this information using the Magento Core API, or even the new REST Api. If you wanted this information you'd need to write your own Magento extension and have it installed on the system you're targeting.
The "Cart" object in Magento ties a specific user account to a specific Magento "quote" object. A quote is an order before it's an order object. In Magento's "PHP API" (i.e. the native PHP objects Magento developers use to manipulate the system), this is a sales/quote object.
$quote = Mage::getModel('sales/quote');
Data for this object is stored in the the sales_flat_quote table, and there is a customer_id column so you should be able to get at the information you need.
The customer.info method does not return the active quote id for the customer according to the documentation, so it doesn't look like you can by default. It's pretty easy to extend the core API with a custom module to provide the quote id though. Or you could extend the checkout module and build a new api method that does the lookup by customer id instead and avoid the customer.info request all together. Have a read of http://www.magentocommerce.com/wiki/doc/webservices-api/custom-api for a guide on how to do this. Benefit of having a custom API method is that you can optimize it (Maybe do a query that gives you just the data you want (i.e. Just the number of products for the quote) instead of loading the full quote object).
P.S. Are you making the request for your drupal site by AJAX? I would as the API is slow and you don't want the drupal site hanging for a few seconds whilst you do the lookup.
Running Magento 1.5.1. My webstore contains a lot of products that get shipped direct from the manufacturer. The cost of shipping is extremely variable, and due to the number of products we carry, it is unfeasible to determine shipping costs for many items.
I would like to add a "request quote" option during checkout. The basic idea I have is this:
-Items without a weight or dimensions will be required to go through an RFQ (request for quote) process. During checkout, if the user has an item in their cart that requires an RFQ (because it doesn't have weight or dimensions defined), it will present a single option for shipping: "Request quote for shipping".
-The next step is the payment screen. Instead of actual payment options, a "pay invoice later" or "pay when quote is received" option will be present. The user will be forced to select this (or perhaps we could skip the payment screen altogether?).
This seems like it should be relatively easy to hack together, but I'm wondering if I'm going about this the wrong way? Is there an easier way to do this? My thought is to modify the checkout code to check for weight or dimensions, if not, only show that one shipping option (I'd probably re-purpose "free shipping" to be that option). Then, in the payment screen, check if free shipping is selected in the order, and then present the custom payment option (probably re-purpose cheque or money order option). From there we'd send them an official quote via Paypal or something similar.
Any thoughts? Thanks!!
I'll offer my normal advice: There are a ton of extensions to let this happen. My philosophy is to start looking at extensions before trying to code anything in magento. Is especially helpful when an upgrade breaks something; they'll usually fix upgrade problems that clearly affect their own extensions for free.
In your case there is a free custom shipping option extension I use for "Will Call" which you can use for "RFQ" purposes. I strongly advise against messing with payment modules. I have written 6 or more "payment" things in PHP for live sites and admin back-end use. Until you really understand Magento, you are wasting your time and money writing code. If your question is to get a website working so you can make money, go buy extensions that get the job done...
To go on about writing code, I hand rolled some code in the contact form to add google re-capcha as well as to have customers select from existing product attributes (vehicle year, make, model). I was eventually able to figure out how to have these reflect in the emails we get from the contact form, however, there is no database persistence, which is the proper solution. Further, mucking about in the code quickly and easily breaks Magento in unexpected and surprising ways, hence why my normal Magento reply on here is to strongly urge people to buy extensions. If you're asking the kind of questions like I would ask, you don't know enough to make a professional extension... buy a few proper extensions, analyze them, spend lots of time trying to figure it out.
Any more there are plenty of extensions competing to do the same tasks, so there should be something already working to do what you want.
I want to add a custom attribute to magento order_item and quote_item and a field in the order form for my serial number attribute and other custom attributes.
I'm selling Tablets offline but I am using Magento backend for managing all inventory and customer information along with orders, the tablets are given on subscription bases so there is no shipping as the customer would be at store during purchase.
I want to add custom attribute which are unique to the customer and tablet.
I could create an attribute for the customer but what if they order more than one tablets which means logically the only way is to place those attributes in the order item.
I seriously don't know how to go about.
I hope someone can point me to extended magento sales module and add my custom attribute to order_item and also show in magento order form.
First you need to add/change this two tables:
- sales_flat_order_item
- sales_flat_quote_item
just add fields and name it as you wish (that will be your new attributes)
file you need to edit for your new attribute to be visible on order page should be this one:
app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
and your new attribute:
<?php echo $_item->getMyCustomAttribute() ?>
If you would like to make that attribute "the proper way" it requires a bit more skill..
Here is an example how you can add custom category attribute, same would be for your problem:
http://inchoo.net/ecommerce/magento/how-to-add-new-custom-category-attribute-in-magento/
Thanks
I would ask some of the more popular extension providers for a custom quote. AheadWorks comes to my mind quickly... I say visit the Magento Connect store and browse through highly rated extensions and you'll see there are a small number of companies doing lots of successful work.
They will be able to "more properly" handle, store, track, and communicate your desired data through the entire system.
Once I better quantify a similar situation I would like to program, I will seek the help of experienced module builders. The Zend MVC is a miserable bowl of spaghetti once you start trying to code in it! :D
I need to grab information from my dropshipper's site. The only thing I really need to grab is the inventory count. What would be the best technique for doing this with php? Should I use cURL? If so, can you please give me some example code of how to do it?
P.S. I am using interspire shopping cart too
Thanks in advance
It's tough to answer without knowing what your dropshipper allows. Mine gave me a detailed user guide with several ways to get data from their servers (cURL, Ruby, PHP, Perl, etc. all with example code).
The way I handled real time stock levels was to build code from one of their examples and using XML-RPC grab the stock levels from the supplier when a customer navigates to the individual product pages. The response from the supplier's server is just the stock number for that product (based on the SKU). My code then inserts that stock level into the prodcurrentinv field in the database for that particular product. This all happens in a split second before the page loads fully (before the stock level display on the page). I added it as a function in class.product.php.
Because I don't really know PHP, I wasn't able to get this to work with more than one SKU at a time (for use in the shopping cart and on the category product listing pages). I'm hiring a programmer for that.
But it's really important to know what type of interaction your supplier allows and it's hard to answer your question without knowing that.