Hello,

I'm trying to use Drupal commerce for an online store selling services to tourists, my problem right now is that the buyer has to select WHEN is he going to enjoy the service bought, i.e. they buy a tour with a price and a date. Nothing should change depending on the dates they are coming (same price, same conditions).

I've already read through all the post/issues/documentation/modules available and so far my conclusion is that the only way to do this in a proper way is to make an attribute “date” and replicate the SKU for every single date but I’m afraid this would become unmanageable since I would have to replicate all my products 365 times per year !!!
How can I solve this? Is there any module solving this?
Thanks in advance and congratulations for this commerce solution.

Comments

rszrama’s picture

Status: Active » Fixed

You can add a date field to your product line item type and expose that to the Add to Cart form. It's fairly new functionality, so it may not be documented.

pardalman’s picture

COMPLETELY SOLVED

Thank you soo much, I've been trying for one-two days... and actually it is really simple once you know how it's done :P

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

davidwhthomas’s picture

I did something similar by adding a new customer profile type, in code, and added the date field to that.
It appears for the user to select during checkout and is visible as a field on the order.

merauluka’s picture

@pardalman, would you be willing to post how you exposed your field to the Add to Cart form? I've looked and looked and can't find the way to do it.

Drupal Commerce is awesome, but its rapid development is leaving documentation in the dust it seems. :-(

davidwhthomas’s picture

@merauluka,

I'm not sure about showing the new line item field in the add to cart form,

However, In case you're interested in an alternative approach, I documented my other approach, using another customer profile entity, here.

http://www.drupalcommerce.org/node/626#comment-2017

Feel free to add notes, as needed.

DT

Tmanagement’s picture

Just for Google purposes.

  1. First of all make sure the date module is installed and enabled http://drupal.org/project/date
  2. Then go to the configuration settings of Drupal commerce /admin/commerce/config
  3. Click on Line item types
  4. Click on Product
  5. Select a field type (if you have installed and enabled the date module correctly you will see here a field type option data)
  6. Enter a lable and select a widget
  7. See on your manage fields tab (also accessible by clicking edit next to your date field) the checkbox below "Add to Cart form settings"

Make sure that when you are ready you add the views you want them to show. And make sure you add a relationship within views (you will find this under advanced -right side views 3-) of type line item. Then add the field to your fields and make sure you select the relationship line item.

stgogiant’s picture

Issue summary: View changes

Hi, I'm doing this exact same thing and have it set up as indicated in comment #1 and it's working fine. However, I need to add one wrinkle to this, which is to be able to "grey out" certain dates on different products once they are no longer available for that particular date. It's kind of like inventory I suppose, but there are no real hard numbers to attach to this inventory, and as I try to explain below, no need to track inventory either.

The best way to think of it is probably tour guides available for given dates. Think of a pool with an undefined number of guides for each product for every day of the year, but at some point the pool will be (or at least could be) empty for any given day. Only the administrator would be able to (or need to) determine when the pool is empty (i.e., there's no need for this to be tracked and indicated by the orders purchased by customers and update in real time). Once the administrator is aware that the pool is empty for product X on date Y, he would "grey out", or disallow that particular date for that product.

Any ideas on how I might be able to add that functionality would be much appreciated.

Thank you in advance!

bluesman2014’s picture

Hi stgogiant, did you find a solution to the problem you mentioned in #8? I'd be interested to know how to do this too.

elvin - albania drupal developer’s picture

i too am interested in the problem that #8 described. Please any suggestions guys?

stgogiant’s picture

Hi Elvin,

I figured out a way to do something similar to what I'd described here by using Date Restrictions for Commerce Line Item (https://www.drupal.org/project/date_restrictions_commerce_line_item) module. With that you can restrict the selectable dates based "allowed" dates you enter in a field on the product display (so it restricts at the product display level, not product level....although I guess you could have only one product per product display to work around that).

It's an OK solution for what I was asking about here, however, as I noted in one of the issues in the queue on that project, once the date restrictions are enabled, the pop-up calendar on the product display (front end for the user) loads a bit slowly, which is kind of a drag. But it does function for the most part in the way I needed.

Hope that helps.

elvin - albania drupal developer’s picture

thanks a lot stgogiant !!! this is a lifesaver!

elvin - albania drupal developer’s picture

actually not. the module is buggy :( thanks for suggesting anyway

stgogiant’s picture

Hi Elvin, you're welcome. In what way did you find the date restrictions module buggy? Other than the issue of the pop up calendar loading slow when the date restrictions are enabled, I haven't experienced any other issues or errors with the module. What were you referring to exactly (out of curiosity more than anything...)

Thanks.

elvin - albania drupal developer’s picture

hello Stgogiant

I installed the module and the dependencies. i tried adding the restriction by having one datefield value (with collect end date to specify dates only from may to july)

it threw some javascript erros and it wouldnt work. the popup wouldnt work either.
maybe i need to add all dates one by one manually but it would be easier to specify from X to Y date and then also add additional dates.