Jump to content

Questions using Apeisa's shopping cart for selling festival tickets


joe_ma
 Share

Recommended Posts

Hi

I'm trying to setup a shop using Apeisa's shopping cart and can't get it running. I don't understand the second step of the readme file:

2. Add sc_price class to your product template (can be multiple templates)

Where and how do I add the sc_price class exactly? Or should it read "sc_price FIELD"?

What I'd like to use the shop for is a ticketshop for a festival. The "products" in this case are the events, which are setup like this:

- there is a page for every event, containing general information about the performers, duration, description etc.

- as events can take place on several dates/times and locations (different shows of the event) with different amounts of tickets available, I get this information from a repeater field containing the following fields: date and time, location, show id, amount of available tickets (sc_qty), and price (sc_price)

- the event.php template displays the general information and loops through the repeater to output a list of oll the shows

How can I get an "add to cart" form, where I can select tickets for one of these shows?

Can I produce my own form with a select box for the shows, that sends the information to the shopping cart?

How can I handle different prices for members and nonmembers? There is no strict logic behind these differences, they are setup rather arbitrarily, there is no way to use a calculation of any sort. So I probably need two fields like sc_price_member and sc_price_nonmember, don't I?

Customers should be able to buy tickets for members and nonmembers at the same time.

Is my setup for the events suitable for this purpose? Or would you take a completely different approach?

Link to comment
Share on other sites

Ok, thanks apeisa.

So I put the sc_price and sc_qty fields on the repeater. For the output on the event page I loop through the repeater like this (the <li> is just for testing):

foreach ($page->time_loc as $product) { //time_loc is my repeater field
	
	echo "<li>{$product->location->title}<br>Anzahl Plätze: {$product->sc_qty}, Preis: " . $modules->get( "ShoppingCart" )->renderPrice( $product->sc_price ) .".<br>" . $modules->get("ShoppingCart")->renderAddToCart(). "</li>";

}

That results in the following output:

  • Casino
    Anzahl Plätze: 80, Preis: CHF 25.00.
    Sorry, we are out of stock.
  • Kino Krone
    Anzahl Plätze: 50, Preis: CHF 25.00.
    Sorry, we are out of stock.

So, instead of having an "add to cart" button, it says "Sorry, we are out of stock", which clearly isn't the case (see "Anzahl Plätze: 50").

Where have I made the mistake?

Link to comment
Share on other sites

Not on computer, but I think you have to tell which product you are adding to cart. I would guess it assumes (without any params) that the current page is product. That's not the case here, since you are using repeaters. Try adding $item as a param to renderAddToCart method (or check source what it requires).

Link to comment
Share on other sites

I still can't get the shop working.

I setup a new template "basket" with the template file "basket.php" where I put the following line:

$modules->get("ShoppingCart")->renderCart() ;

But when I add a ticket to the basket and then call the page with the basket template, that doesn't render anything.

Link to comment
Share on other sites

Still struggling …

The shopping cart and the order management as they come out of the box don't show the details of the orders. So in this case here, the overviews don't specify what exactly has been ordered.

The code from post #3 in this thread produces the following lines:

Donnerstag, 10. April 2014, 20:00 Uhr, Casino; Anzahl Plätze: 73, Preis: CHF 25.00. (plus add to cart form)

Dienstag, 15. April 2014, 20:00 Uhr; Kino Krone; Anzahl Plätze: 44, Preis: CHF 25.00. (plus add to cart form)

Which is as I expected. But in the overviews of the shopping cart and in the order management I see only this:

Title of the event (i.e. the title of the event page), Number of Tickets, Price.

How can I get the details of the show (i.e. the information from the repeater) as well, like this:

Title of the event, date, location, Number of Tickets, Price ?

And do you have any ideas for this:

How can I handle different prices for members and nonmembers? There is no strict logic behind these differences, they are setup rather arbitrarily, there is no way to use a calculation of any sort. So I probably need two fields like sc_price_member and sc_price_nonmember, don't I?

Customers should be able to buy tickets for members and nonmembers at the same time.

Thanks a lot for your precious help.

Link to comment
Share on other sites

Just want to mention that the shop module isn't a very complete solution and for anything special you will need to get your hands dirty. You won't get it working the way you need without modifying every shop module and make it your own completely. You could take it as a kickstart to your own shop.

Just for clarification, using the repeater support currently in the shop module is meant for variations. Means the page the repeater is on is the product. If using this the saved item will have this format.

PageTitle: RepeaterTitle 

There's no support for other fields than the title! But one could use the title field of a repeater to save more than just a title. Maybe a "title, date, location" that constructed on page save with hooks, or on runtime modifying the $page->title of a repeater.

Note that also every repeater is a page in the back and this makes it easy for the shop to take a variation as a page with it's own ID. Repeaters can have they're own price field of not it will take the page price field.

So as you might found out you can loop the repeater out and create a add to cart form for each. Since it is a repeater page, shop module recognizes it as a own product/variation.

Currently you seem to use this system for events that require multiple tickets, so 

- EventPage

- repeater: EventTickets

- repeater: Event2Tickets

So far so good, but it seems you even need variations for the price for each "ticket", but you already have used variations for the tickets for the event. This will get tricky as there's no support for multiple prices per item. So no way to get further with this approach unless you completely adapt the shop system. 

What you could try also is to add each ticket as a subpage instead of in the repeater of the event page. Then you can use repeaters to on those subpage's still to create variations for one ticket, member and nonmember. Each having their price.

- EventPage

   - EventTicket1 (childpage)

    - repeater: member (item to add to cart)

    - repeater: nonmember

  - EventTicket2 (childpage)

   - repeater: member

   - repeater: nonmember

This could work out better and you still can construct your event page just using childpages and their repeaters to have options (maybe as a select)

Then, you "only" have to adapt cart, checkout and management module to have  Productitle: repeatertitle do what you need. 

  • Like 1
Link to comment
Share on other sites

Thank you soma for these clarifications.

- EventPage

   - EventTicket1 (childpage)

    - repeater: member (item to add to cart)

    - repeater: nonmember

  - EventTicket2 (childpage)

   - repeater: member

   - repeater: nonmember

This sounds definitly like a good idea. I'll give that a try.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...