Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Tour/Activity Reservations - Can I make it easier?

Tour/Activity Reservations - Can I make it easier?

Views: 3,434

Results 1 to 20 of 28
11 Dec 2013, 12:33 AM
#1
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Tour/Activity Reservations - Can I make it easier?

Our business is booking people on tours and activities and so far I've got something that works (should anyway, haven't made the site live yet) - I just want to make sure I'm not making this harder than it needs to be because I've hit a few snags and it's taking me quite some time to do.

We used google checkout (which can still be seen on our current website, for instance here: http://www.shakatourshonolulu.com/luausandshows/paradisecoveluau.html#res) which suited our needs well. I could just display the prices with html, let a customer choose their options, etc., which would trigger javascript that did some math and just changed the prices on screen and google checkout would parse the information from the page, and I'd have a product sitting in my shopping cart with all the relevant info we need and the correct price and it all happened lickety-split. Unless I've totally overlooked it - which can happen, I get stuck on spesearch terms sometimes and end up looking for the wrong words - it doesn't appear that Zen Cart can create a product by parsing info from the page (something to add to a future upgrade?).

SO, I've pretty much had to do everything via product attributes, which works, but is turning out to be cumbersome and limited.

Take this product page for example: http://www.shakatourshonolulu.com/zencart/index.php?main_page=product_info&cPath=&products_id=203 (I haven't added any styles yet to some of the product attributes, it's just taking me so long to input option names/values/prices). The price for the product is different depending on a person's age, and changes depending on transportation and package options, and a person could book 100 seats. That's all fine and dandy, I can accomplish all of this with product attributes, but I'm having to input so many different values it's taking me forever, and more importantly has resulted in load times that are prohibitively long because of all of the attributes.

Is there a way to maybe optimize the numerous attributes so that it doesn't take so long to load? Otherwise I'll limit the number of values that load and prompt a customer to call for higher quantities.

Am I over-complicating things? Is there just an easier way to do this with zen cart?

Also, the different combination of product attributes has led the display price for some products to be $0.00. Is there a way to manually set the display prices?

Any help or insight would be most appreciated.

14 Dec 2013, 8:00 AM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

Re: Tour/Activity Reservations - Can I make it easier?

I do understand the complexity of dependent attributes on your site.

In theory, one could make a landing page with package 'options'. Those options could represent a number of 'products/services' that could easily be added to the cart. Then each of those could have various attributes.

Alternately, everything being available on one 'product' page may run smoother with a form that populates directly from the database, with minimal use of attributes if at all.

15 Dec 2013, 11:19 PM
#3
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

twitchtoo:

I do understand the complexity of dependent attributes on your site.

In theory, one could make a landing page with package 'options'. Those options could represent a number of 'products/services' that could easily be added to the cart. Then each of those could have various attributes.

Alternately, everything being available on one 'product' page may run smoother with a form that populates directly from the database, with minimal use of attributes if at all.

Thanks so much for your advice, twitch. I'd go with the second alternative as everything right there on one page would be a sexier solution; some of our competition uses the first method with the landing pages and it does get clunky.

Both of those options are, actually, a little bit above my current coding skill level (these last few months with zen cart have been my first foray into php, databases, etc.). I think I'd finish the slow inefficient method I'm doing now before I look into how to do it one of those other ways if I need to...

...and I say if I need to because I had a thought. Is this possible?:

What if I used my old background javascript formulas to get a product price and then, using the "Variable Price Product or Donation" (https://www.zen-cart.com/content.php?324-Variable-Price-Product-or-Donation) method, just used some javascript to set that resulting answer into the quantity box (the "price"). Would that work?

16 Dec 2013, 3:25 PM
#4
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

Re: Tour/Activity Reservations - Can I make it easier?

I've seen some fancy java do all the work, then cleanly drop the data into the database. If it works smoothly on mobile it would make a host of 'product info' details many times EASIER than manually entering data over and over and over and...

When you get the opportunity to java, I'll help with the php :)

16 Dec 2013, 11:16 PM
#5
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

OK that's the route I'm going, then.

Just need to make sure the javascript is firing the way I want to in zen cart, looks like my radio buttons need a little work. So I'm clear on what I'm doing and before I go too far down the wrong path:

I'm going to still have attributes attached to the products so that when somebody adds the product to the cart we'll still know what the attributes/details are for those products, but the attributes they select will trigger javascript that calculates the price, outputting that number to a quantity box (since I've set the price for the product to $1) that I will rename to "price", and then I guess I'll have to remove the quantity boxes from the other pages so they can't be manipulated.

That's what I've started to do anyway, hoping that I'm not gonna hit a dead end. Please let me know if I'm wrong!

Thanks for all the help.

17 Dec 2013, 1:49 AM
#6
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

Re: Tour/Activity Reservations - Can I make it easier?

If you're going to use java, you can easily bypass all of the ZenCart code and simply place the data in the appropriate fields in the database. Then you aren't bound to the structure/features of the attributes controller - pros/cons?

We would need to develop a simple way of seeing or interpreting the data if for some reason it didn't make sense in the admin.

Alternatively holding on to product attributes and using java as a calculator keeps it simple for future ZenCart upgrades. Filtering the product info - hiding the quantity boxes with various conditions - is pretty easy :)

2 Jan 2014, 11:56 PM
#7
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

Went the easy route and used javascript as a calculator and hid the quantity boxes. I just need to style a few things, polish it up a little, but it's looking like I want.

The problem I have now (not a huge one, I don't think) is that the list prices on my category pages all show $1, since the final price is set by the qty. Is there some way to set the list price manually? Or a way to replace the entire block of a product listing on the category page to a block of my own html?

3 Jan 2014, 3:55 AM
#8
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

Re: Tour/Activity Reservations - Can I make it easier?

That javascript sounds like a potential plugin for ZenCart... do share ;)

List price hide - yes, can you send an example of the problem?

5 Jan 2014, 10:49 PM
#9
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

twitchtoo:

That javascript sounds like a potential plugin for ZenCart... do share ;)

List price hide - yes, can you send an example of the problem?

Yeah you know I'm surprised it wasn't already out there. It seemed like a lot of people trying to do something with reservations gave up when they couldn't find a way to restrict dates through zen cart or the zen cart plugins. All I did was make the date selectable through a calendar widget (I used the yahoo yui calendar, because I had used an earlier version before and am happy with its usability).

I'm afraid that actually making a plugin is something I don't have the time nor expertise to do right now, but if somebody else would like to author it, be my guest! Just hopefully it'll be a free plugin.

The method is simple, it just gets complicated and long when there are a lot of conditions/variables: have your javascript formula to calculate the price running in the background. The user inputs relevant information (quantity, options, etc.) which become the variables of the formula (or formulas, conditional statements may change the formula used). When a user inputs their values into the fields an onchange/onclick event will update the javascript formula. The computer solves the equation and spits out an answer and with a little javascript I make that answer be the value ( document.getElementById("cartprice").value=newtotal; ) of the product's cart quantity (that I've added an id of "cartprice" to). And since we've set the product's price to $1, whatever the cart quantity is will be the price.

Problem is, since I'm calculating all the product prices that way, all my products show a price of $1 (http://www.shakatourshonolulu.com/zencart/index.php?main_page=index&cPath=67) when listed. So now I'm looking for a way to either change the price that shows, or replace the whole listing with a custom one of my own. Any ideas?

I was thinking maybe I could use javascript to replace the prices but I'm having trouble targetting the individual fields and I'd like to do it another way, in case somebody isn't running javascript they can at least see what the price is.

6 Jan 2014, 1:37 PM
#10
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Tour/Activity Reservations - Can I make it easier?

twitchtoo:

I've seen some fancy java do all the work, then cleanly drop the data into the database. If it works smoothly on mobile it would make a host of 'product info' details many times EASIER than manually entering data over and over and over and...

When you get the opportunity to java, I'll help with the php :)

I hate to be a pedant, but Java and Javascript are not the same thing. They aren't even related to each other.

I'm not trying to be critical of you, it is quite a common misunderstanding that few people will try to correct you on for fear of causing offense.

Cheers
RodG

6 Jan 2014, 11:00 PM
#11
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

RodG:

I hate to be a pedant, but Java and Javascript are not the same thing. They aren't even related to each other.

I'm not trying to be critical of you, it is quite a common misunderstanding that few people will try to correct you on for fear of causing offense.

Cheers
RodG

If Java is what I need to use to fix my list price problem I'm all ears. What do you suggest?

7 Jan 2014, 5:08 AM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Tour/Activity Reservations - Can I make it easier?

Rod was simply pointing out that Java and Javascript are unrelated. Javascript is what you need for your job, and what twitchtoo was talking about.

7 Jan 2014, 7:26 AM
#13
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Tour/Activity Reservations - Can I make it easier?

Mike D:

If Java is what I need to use to fix my list price problem I'm all ears. What do you suggest?

Just to backup Glenns response. Javascript is what you need. Not Java.

Cheers
RodG

7 Jan 2014, 8:02 PM
#14
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

Sorry guys, are you saying that javascript is what I should use to change the prices on my category pages? Because I'm not sure how to target the specific prices as they don't have unique #ids or .classes, and I'm not even sure where I should put the javascript (I've still not been able to get page specific javascript to work correctly).

Thanks a ton. I appreciate all the help!

8 Jan 2014, 2:41 AM
#15
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Tour/Activity Reservations - Can I make it easier?

You would probably use javascript to dynamically display the prices, but first you would need to alter the PHP file(s) to show unique ids for each relevant element.

If you are editing the PHP files anyway, it might be feasible to do the dynamic calculations there, if this display is not dependent on user action.

13 Jan 2014, 9:02 PM
#16
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

I'm fairly certain I know what I should be doing but I'm not sure how to do it.

In my product_listing.php file I'd like to modify the variable $lc_price to have an id. I'm trying to make the id "priceX", where X is the product's id#, I figure that'd be the most straight forward and consistent way to assign ids to those elements.

Problem is I think I'm making it harder than it needs to be again. I've tried dozens of code which are all, apparently, wrong (I feel like I'm trying to swat a fly with a baseball bat in the dark - it's a good thing I've made backups). Could somebody tell me the code I need to make the product id# part of the id?

        $lc_price =  '<span class="price" id="priceX">' . zen_get_products_display_price($listing->fields['products_id']) . '</span><br />';
14 Jan 2014, 8:31 AM
#17
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Tour/Activity Reservations - Can I make it easier?

Something lik this?

     
$PrID = "price".$products_id ; 
   $lc_price =  '<span class="price" id="$PrID">' . zen_get_products_display_price($listing->fields['products_id']) . '</span><br />';

This assumes the products_id is found in nthe variable called $products_id. You may need to 'escape' the quote characters. I'm not near a computer that I can use to test this with at the moment.

14 Jan 2014, 3:31 PM
#18
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Tour/Activity Reservations - Can I make it easier?

You will want to drop out of string mode to insert the value of $PrID:```
$lc_price = '<span class="price" id="' . $PrID . '">' . zen_get_products_

```php
$PrID = "price".$products_id ; 
   $lc_price =  '<span class="price" id="' . $PrID . '">' . zen_get_products_display_price($listing->fields['products_id']) . '</span><br />';
14 Jan 2014, 8:21 PM
#19
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Tour/Activity Reservations - Can I make it easier?

No dice. The id is coming back simply as "price". Should I not have assumed the product_id was in the $products_id variable?

15 Jan 2014, 3:02 AM
#20
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Tour/Activity Reservations - Can I make it easier?

The product id in product_listing.php is held by $listing->fields['products_id'].