I am trying to implement hotel booking functionality in a Drupal 7.26 website. Customers will choose hotels from a listing page and then they will select rooms within the hotel.
I decided to use UberCart 3 for my booking mechanism.
First I implemented 'Hotel' as a Ubercart product. But a hotel is connected to rooms, each type of room has a different price. Using product attributes, I designed room type as an attribute, with each room type having a different price. So far so good, but I could not select multiple instances of any single product attribute, so I abandoned using Product Attributes.
Then I decided on this different approach. I decided to keep the room type information inside the hotel product type, using field groups.
Here's how it looks in the add content page:
Using some view templating, I managed this look in my booking page. This look is exactly how my clients want (apart from the css anyway). I am getting to book multiple instances of a room.
However, when I click on any 'Add to cart' button, Drupal does not detect that which room type was selected. I modified the rendered markup of the Add to cart form (using tpl files), and added a hidden field called roomtype for each add to cart button. So for the first button, roomtype = 'double', and for the second button, roomtype = 'single'.
My idea was to
use hook_uc_add_to_cart,
then process this roomtype value, and
then compute the price of that roomtype,
then update the price of the cart item,
and then redirect to cart page.
But hook_uc_add_to_cart provides only quantity, node id and a data variable. None of these gives me the value of the roomtype hidden field.
How do I use my hidden fields in my uc_add_to_cart hook?
Try this:
http://drupaldeveloper.in/codelet/drupal-add-product-field-cart-ubercart
This code has similar solution.
Regards.
Related
I am using wpforms elite (with webhooks) in hopes to simplify the order process for woocommerce customers.
When a user submits the form at this url, http://implantlogic.wpengine.com/device-selection/ I hope to have products added to the cart based on users selections.
For example, if the user selects tooth one on the tooth selection page of the form, this product will need to be added to the cart with all fields populated http://implantlogic.wpengine.com/product/tooth-1/ and this applies to other things the user selects on the form as well which would trigger simple field mapping or the addition of simple products to the cart.
Right now I just need to know if this is possible or if I should seek other methods to solve this issue and create the same experience.
I'm using Drupal Commerce and i have a product type called "Painting" this product type does not have an attribute fields, I'm using inline_entity_form module so i can show the product add form within the node add form for my product display content type.
The product in the site is the painting itself, it may come with a frame or without a frame (the user can choose) and the price will change based on the user's choice, how can i add such field without using attributes fields? as attributes fields requires that the site admin to add many products and put them in one product display, i just want to keep it simple to the site admin, to make him add the product in the same way he adds a node.
Thank you.
This sounds like you just need two variations:
Product one, without frame
Product two, with frame
Each variation has it's own price and title.
You can get by without using an attribute field. Drupal Commerce renders a dropdown when there are no attributes and allows user's to pick from the product variation titles. Since you are using Inline Entity Form this should be seamless for the site admin.
I am designing a T-shirt store for a client and need to be able to add custom fields to a BigCommerce product based on the user requesting more than one product (tshirt)
So - if the user has 2 products - they would be asked to complete fields for reverse name and size. Is this possible?
There aren't conditional options out of the box in Bigcommerce. You'd have to have unrequired fields that were hidden unless multiple quantities were selected (using javascript to accomplish the hide/show).
Alternatively, you can limit the item so only one can be added to the cart at a time. This could be a negative customer experience though.
I've found the following example (WooCommerce: Add product to cart with price override?) which lets the user add a product to the cart. However, it hard codes the prices directly on the cart itself.
Is there a way to make adjustments to a product instance i.e. costs, append additional user input, etc. and then add the product to the cart?
Thank you very much for everyones help.
Edit:
Having another crack at explaining, as doublesharp has pointed out it's not quite clear.
Joe clicks on a product, he then chooses various options on the product form which then calculates a custom cost after the 'add to cart' button is clicked but before it is added to the cart.
These options need to be completely custom as the calculations involved are outside of scope of a woocommerce 'variable product'. What I'm trying to achieve is the customer being able to add multiple instances of the same product with various costs and info associated with it.
With regards to the first part of your question where you want to add multiple instances of a product with various costs, you can have a look at the following plugins to achieve that objective
Dynamic Pricing
Pricing Deals for WooCommerce
As for the second part of your question where you want to append additional user input to the cart. This can be done using the following steps
Create a custom session and add the custom data to this session.
Add the data from the custom session to the WooCommerce session.
Extract custom data from WooCommerce session and insert it into cart
object.
Display custom data in Cart and Checkout page.
Add custom data as metadata to the order items.
Remove the associated custom data if an item is removed from the
cart.
For a more detailed on the above steps you have a look at the following link,
How to Add Custom Data to WooCommerce Order
I have created a content type Products.
Its having price, ratings ,and other fields. And whenever I add a content for this product type it gives me submission date for that product.
I have added 10 contents for this content type and created a view which displays all the products in a list. now i want to give a filter for "Price, Date and Ratings".
E.g, if I select price then it should sort the view list of product from lowest price to highest price value.
Any module is available to achieve this?? or any other procedure which can make this happen for product filter.
I have used Better Exposed Filters module in drupal for the same requirement. And i feel it will be very useful for you.
Just install the module from this link:
http://drupal.org/project/better_exposed_filters
Enable the module. and Go to view(Create a new view and add your fields. For e.g, Price,Ratings,Date according your requirement. Else if you have already created a view then use the same and edit it.)
Click on Exposed form(In Advance) and select "Better Exposed Filters ".
Now select the filters you want in Sort Criteria(For e.g, Price,Ratings,Date).
Click on Use AJAX and select "yes"(Mandatory field).
Click on Save and Enjoy Your View with the Filter.
Hope this will be useful.
If you edit the view and add a sort criteria for your field price there should be an option to expose it (tick box).
If you tick "Expose this sort to visitors, to allow them to change it" the sort filter will appear at the top of the view.