We’re rewarding the question askers & reputations are being recalculated! Read more.
22

Using the entity metadata wrapper, you could also do: foreach (commerce_order_load_multiple(array(), array('status' => 'pending'), TRUE) as $order) { $product_ids = array(); foreach (entity_metadata_wrapper('commerce_order', $order)->commerce_line_items as $delta => $line_item_wrapper) { if (in_array($line_item_wrapper->type->value(), ...


16

I'm using this: $payment = commerce_payment_method_instance_load('foo|commerce_payment_foo'); where foo is the payment method string identifier. The resulting array contains the 'settings' index, with the data saved in the settings form. In other words foo|commerce_payment_foo is instance id which consist method_id|rule_name. The method_id can be found ...


15

You don't need to change the order directly, commerce_cart_product_add do it for you. Try this code: Variables: $product : commerce product $quantity: number of elements Code global $user; // Create new line item: $line_item = commerce_product_line_item_new($product, $quantity); // Add to current user's cart: if the user is not logged in ($user-&...


15

Here is the method I used. It covered all of the functionality I needed, and we ended up with a very robust website, using popular well maintained modules, and getting the exact results we needed. Modules used Commerce Commerce_agree_terms Commerce_autosku Commerce_cart_expiration Commerce_event_ticket (For PDF creation) Commerce_stock Date API Inline ...


14

For theming cart page add page--cart.tpl.php in your theme's templates directory. For theming checkout page add page--checkout.tpl.php in your theme's templates directory. If you want to theme only the checkout review page add page--checkout--review.tpl.php in templates directory. After adding tpl files do not forget to clear cache. If you want to know ...


13

The code would look something like this: function MYMODULE_menu() { $items['cart/empty'] = array( 'title' => 'Empty Cart', 'access arguments' => array('access content'), // or whatever permission you want 'page callback' => 'MYMODULE_empty_cart', 'type' => MENU_CALLBACK ); return $items; } function MYMODULE_empty_cart() { ...


13

The most secure place to store credit card numbers will be on a third party service designed to securely retain that data. These service providers are PCI Level 1 compliant with code and systems in place to prevent the unwanted or unexpected exposure of sensitive card data. Many payment gateways support such "card on file" functionality, where they allow ...


13

Commerce Kickstart has that. We use the jquery_ui_spinner library, extracted in our libraries folder. We declare the library in a hook_library implementation: /** * Implements hook_library(). */ function commerce_kickstart_product_ui_library() { $libraries['jquery_ui_spinner'] = array( 'title' => 'jQuery Spinner', 'website' => 'http://...


12

It's Drupal...there's always a way, but the amount of time it will take to do might make you think twice :) If you look a bit further up the food chain so-to-speak you'll see that this function is exclusively used by commerce_price_table_field_formatter_view(), which declares a field formatter that is used for the commerce_price_table field type. With that ...


12

First create a Rules component for setting the status of a product. Go to Configuration -> Workflow -> Rules -> Components -> Add new component. Create an Action set. Give the component a suitable name, such as Set product status. Create a parameter of type Commerce Product, label Product, machine name product; and another of type Truth value, label Status, ...


12

You aren't just using Drupal Commerce, are you? It sounds like you're using Commerce Kickstart or Drupal Commerce with the Commerce Checkout Redirect module enabled. That's what's responsible for the behavior you're describing. Just disable it and enable the "Access checkout" permission that David Thomas pointed to.


12

You may try to test a new module called Commerce Drush which has the following syntax: drush commerce-order-add 1 drush --user=admin commerce-order-add MY_SKU123 Manual solution For creating an order programatically in Commerce, you can use the following code (it works with drush as well, e.g. drush -vd -u "$1" scr order_code-7.php). Please note that ...


11

Here is a nice tutorial on how to set up an EXPRESS CHECKOUT using Rules to bypass the add to cart stage. I noticed there is a Commerce Express Checkout module, but I personally rather use rules to do it. To display this on your home page, using the views module you'll need to create a block view of your product and put it in your home page.


10

The product's type is a property of the commerce_product entity, so you can use the built-in "Data comparison" condition to test it. Just add a new condition of type "Data comparison", and make the data selector look like this: When you continue you'll get a screen like this: As you can see you get a nice drop down list of product types to choose from. I ...


10

What you're looking for is the filter criteria Global: Fields comparison:)


10

Two things there: A. Define your custom order states with one of the Order info hooks. hook_commerce_order_state_info hook_commerce_order_status_info B. Create a commerce_order based VBO view and add an operation to change the order state. It won't be a button on each row, just a checkbox or radio button, but you can batch update that way. Alternatively, ...


9

I can't remember the exact structure of the commerce product reference field, but you need to do something like this. Warning this code style won't work on many orders as the internal cache for the line item entities will use too much memory. This will be a problem if you have thousands of orders. $orders = commerce_order_load_multiple(array(), array('...


9

Here's a quick way using hook_block_view_alter(): function MYMODULE_block_view_alter(&$data, $block) { if ($block->module == 'commerce_cart' && $block->delta == 'cart') { global $user; if ($order = commerce_cart_order_load($user->uid)) { // Count the number of product line items on the order. $wrapper = ...


9

I figured out answer, and it's not that bad as I though. I decided to write a tutorial for it as it looks like very useful feature. So here it is: Tutorial Install everything, I mean, Commerce and Webforms, Create example webform - let's name it "Contact", Create Product Display, create some product with few attributes, and one boolean field (not attribute)...


9

You may need to check the permission, under Admin > People > Permissions : "Access checkout" for anonymous users. If the user does log in, their anonymous order will be added to their authenticated user cart.


9

As you mention you're looking for setting the profile as default, I'm assuming you're using Commerce Addressbook or in any case looking for a very similar feature of what that module provides. Commerce Addressbook is a module that allows authenticated customers to reuse previously entered addresses during checkout. They can manage all entered ...


8

The only template files in Commerce related to the checkout module are commerce-checkout-errors-message.tpl.php and commerce-checkout-help.tpl.php. These are located in the Commerce module directory under modules/checkout/theme. The only template file related to the Cart module is commerce-cart-block.tpl.php, which is located in the Commerce module ...


8

It looks like using hook_commerce_checkout_pane_info_alter(&$checkout_panes) or hook_commerce_checkout_page_info_alter(&$checkout_pages) would be the best options. There are also hooks that allow you to create your own checkout panes/pages from scratch if necessary (hook_commerce_checkout_pane_info() and hook_commerce_checkout_page_info()). I would ...


8

Well I can come out of two ways of doing this. One of them is Using the commerce API which is really good you just have to get all your 500 products with the following method: $query=new EntityFieldQuery; $query= $query->entityCondition('entity_type','commerce_product')->execute(); foreach($query as $entity){ $entity->...


8

Go to http://mysite.com/admin/store/products/classes Enter the machine name of your content type in the 'Class ID' text field. Enter a human-readable name for your new product class (and optional description) Click save Ubercart will now register the content type with the machine name that you added in the above steps as a product. Next time you add/edit ...


8

Easy (assuming Drupal commerce 7.1 in my testing) - you want to just navigate to Admin > Store > Commerce Profiles > Profile Types > Manage Fields > [Your Address Field] > Edit Under 'Available Countries', select the ones you want per the instructions 'If no countries are selected, all countries will be available.' You may also refine the list of ...


8

Well this seems to work! global $user; $order = commerce_cart_order_load($user->uid); $wrapper = entity_metadata_wrapper('commerce_order', $order); foreach ($wrapper->commerce_line_items as $delta => $line_item_wrapper) { $type = $line_item_wrapper->commerce_product->value()->type; if($type=='X'){ ...


8

The solution likely depends on the billing customer profile's address field using a split first and last name field instead of the combined "full name" field. I've noticed on my Commerce site that there appears to be a bug in Address Field (hope to fix soon) that prevents a full name field from being split up into first and last name fields or vise versa. ...


8

Found the solution. My rule was already sending an email but I could not see any token for the customer first and last name. Add a condition "Entity has field" > commerce_customer_billing Add an action "Fetch entity by id": Entity type > Value: Commerce Customer Profile Identifier > Data selector: commerce-order:commerce-customer-billing:profile-id ...


8

Try this Create view (block) Add fields (title, a small image, date, whatever you like). Or teasers, what works as well. “Arguments” is from now on called “Contextual filters”, so go there. Add the filters: “Content: Has taxonomy term ID (with depth)” and “Content: Has taxonomy term ID depth modifier” Configuration on this filter: → ...


Only top voted, non community-wiki answers of a minimum length are eligible