Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 02-23-2004 15:41:37

morvak
Member
Registered: 11-02-2003
Posts: 96
Website

Static Pages & Inventory

when someone purchases from a static page, before the order is added to their cart, can it check the inventory first? or no - this can only be done if i use the cart itself (ie. no static pages will work with inventory checking)

thanks again!

Offline

 

#2 02-23-2004 16:15:44

Greg
Member
Registered: 12-07-2002
Posts: 315

Re: Static Pages & Inventory

morvak,02/23/2004 03:41:37 PM wrote:

when someone purchases from a static page, before the order is added to their cart, can it check the inventory first? or no - this can only be done if i use the cart itself (ie. no static pages will work with inventory checking)

thanks again!

Requires a mod.


Greg
GRC Web Building & Graphics

Offline

 

#3 02-23-2004 16:20:31

morvak
Member
Registered: 11-02-2003
Posts: 96
Website

Re: Static Pages & Inventory

how difficult is this to do ? seems like all you need to do is do a check on the inventory right ? am i on the right track ?

Offline

 

#4 02-23-2004 18:00:29

Greg
Member
Registered: 12-07-2002
Posts: 315

Re: Static Pages & Inventory

morvak,02/23/2004 04:20:31 PM wrote:

how difficult is this to do ? seems like all you need to do is do a check on the inventory right ? am i on the right track ?

Yes, but it is a bit more involved than writing a simple expression.


Greg
GRC Web Building & Graphics

Offline

 

#5 02-23-2004 18:19:18

scoutch
Banned
Registered: 07-03-2003
Posts: 3167

Re: Static Pages & Inventory

Where exacly do you want to put your inventory ? Below each of your products ?


______________________________________________

THIS USER HAS BEEN BANNED FROM THIS FORUM.

If this post contains any language related to
code samples, advice, etc., please read this
entire thread before making a decision to use
this post as a basis for any change to your
software installation.
______________________________________________

Offline

 

#6 02-26-2004 10:19:12

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Static Pages & Inventory

If you're using the remote product API the answer is no. 

If you've just simple copied the HTML form from a product detail display page for a product in the database that's inventories and you're trying to add that to the cart from an HTML page, then the answer is yes - it will check the inventory automatically.


Nick Hendler

Offline

 

#7 02-19-2009 20:22:56

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Static Pages & Inventory

Yes but...

I have this on options and it will not show an option if inv. is 0 - that's ok - but it does not seam to lower the inv. when an item is purchased.

Offline

 

#8 02-20-2009 08:20:08

vbsaltydog
Member
From: Florida
Registered: 05-02-2005
Posts: 947
Website

Re: Static Pages & Inventory

As Nick referenced, are you using the "remote add to cart" ? Do you have a link to the static page for review?

-Stephen


Latest CCP 7 XMods Available:


Offline

 

#9 02-20-2009 11:09:10

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Static Pages & Inventory

Hi,

Sent a PM with link - I am using remote add to cart but using the options stored in the product options part of the database

Last edited by celdirect (02-20-2009 11:11:23)

Offline

 

#10 02-20-2009 12:41:38

vbsaltydog
Member
From: Florida
Registered: 05-02-2005
Posts: 947
Website

Re: Static Pages & Inventory

remote add to cart does not calculate inventory so it will not reduce the inventory count upon ordering.


Latest CCP 7 XMods Available:


Offline

 

#11 02-20-2009 17:25:39

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Static Pages & Inventory

Hi,

Why does it not update?

I know its remote add to cart but it is calling the options from the database and not making the options from static code - so surely it should update - or is it because the product belonging to the options is not in the database?  but the product it self does not need inventory control just the options????

I am confused.  If any one can shed some light - it would be very helpful - thanks

Offline

 

#12 02-20-2009 17:37:20

vbsaltydog
Member
From: Florida
Registered: 05-02-2005
Posts: 947
Website

Re: Static Pages & Inventory

I would have to examine the code again to confirm that remote add to cart items are not updated but I do remember from previous coding on remote add to carts that the item does not need to exist in the db in order to be added so maybe there is a flag set to the cart when a remote item is added and that flag tells the order process not to alter the db for the item? This is only a guess of course. I would have to look further to confirm and the time would be billable. Perhaps Rachael can assist?


Latest CCP 7 XMods Available:


Offline

 

#13 02-20-2009 18:28:24

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Static Pages & Inventory

Afraid I don't know the answer to this one.  I do use several remote add-to-cart pages (not on the frontend though), but none of them use a hybrid that attempt to deal with the DB at all.  I do know that the remote add to cart subroutine is entirely separate from the CGI add to cart routine, so there may well be a difference in handling there.  There is also the matter of the way the product identifiers are handled.  When you use the CGI routine, it stores the product number and the product reference string in the cart and DB.  But when you use the remote routine, it only stores the product number.  That is the flag that is used to differentiate the handling downstream and that likely what keeps the options inventory from updating on completion of the order.

This may seem a silly question, but is there some particular reason you couldn't just get these products in the database and be done with it? 

Another way to go about this, if you absolutely need a static page, is to put the product in the database (you can leave the categories blank if you don't want it to show up anywhere), add the product reference string as a hidden field (see the source of a CGI page for an example) and use the regular CGI add to cart routine (again, see the source of a CGI page to see how to change the form fields).  I'm pretty sure the CGI add to cart routine cannot tell if the product is added from a static page or a CCP page if the form fields are right, so you might be able to trick it that way if you put a dummy product in the DB.  Just a thought.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#14 02-20-2009 18:31:13

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Static Pages & Inventory

Another question worth asking here is how on earth did you get a remote page to pull options from the DB?  It might help to answer the question if you provide a bit of technical background there.  If you've just hardcoded options into the remote page that happen to match options in the DB, then the two won't be related at all, even if they have identical identifiers.  You might be able to trick it with the method I described above, but otherwise, there will be no link between the two in that scenario.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#15 02-20-2009 18:33:07

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Static Pages & Inventory

Hi,

Thanks for the reply - what you said makes sense. 

I have looked in the temp, cart tables and the only difference i can see is, that in a non remote page using the same options it shows a number ie 5276 under heading cart_prodoptionsinv - so this info of the cart_prodoptionsinv is not passed on the remote add to cart.

I will look more into the cart.pl file and see what I can find.

thanks for putting me on the right track

PS. EDIT

Hi Rachael,

I was writing my reply as you posted - so only just seen yours.

I was a core mod from muse that we use as the base for what we do - I will PM you the link

Last edited by celdirect (02-20-2009 18:37:55)

Offline

 

#16 02-20-2009 19:00:36

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Static Pages & Inventory

Oh, ok.  So the page where you design the shirt creates a "static" page for the design that is then added to the cart... is that about right?  That being the case, I would consider this possible approach... don't know if it will work, but worth a try:

1. Make a dummy product in the DB.  Don't assign it to any categories so it won't show up anywhere.  Set it to NOT use declining balance inventory.

2. Change the Muse mod in the following ways:

2a: Make it pass the right fields to use the CGI add instead of the remote add.  Look at any DB product, any of the ones from my site if you'd like, and examine the source to see how the field should be passed.  I believe it is just a matter of changing the pg hidden field.

2b: Make it pass (always the same) dummy product reference string in another hidden field.  Again, reference the hidden fields from a DB product for how it's done.

2c: Make sure (by examining the source as described above) that you have any and all other necessary fields for a CGI add and cause the Muse mod to include any that are missing.

As best I recall, the CGI add to cart routine doesn't compare the product number to the product reference string, so you should be able to always pass the same dummy product reference string while using your Muse mod to create different product names and numbers the way you do now.  If I have this right, it should function the same, except for the fact that it would treat it as a DB product and do the right inventory stuff. There might be some unintended side effects, so keep good backups and check the thing out thoroughly afterward, but I believe it is worth at least investigating this approach - it's a fairly minimal amount of changing and it might just do the trick.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#17 02-20-2009 19:11:55

vbsaltydog
Member
From: Florida
Registered: 05-02-2005
Posts: 947
Website

Re: Static Pages & Inventory

As Rachael pointed out, this approach can work. The field <INPUT TYPE="HIDDEN" NAME="cart_api" VALUE="Y"> from the remote cart forms is what tells the cart functions that it is an api item vs a cgi item. If that field is not passed as form data, and the required form data is passed, and the item that you are passing as form data does exist in the database, and the add is done from the local domain/local script then it should work. Please follow Rachael's advise about the backups first.


Latest CCP 7 XMods Available:


Offline

 

#18 02-20-2009 19:56:58

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Static Pages & Inventory

Hi Rachael & Stephen,

Thanks for your help - I think I understand now.

In my script i commented out <INPUT TYPE="HIDDEN" NAME="cart_api" VALUE="Y">

Put in this <INPUT TYPE="HIDDEN" NAME="ref" VALUE="BC551686"> to a product in the DB not using inventory.

It worked - but caused bugs, showed that products name and number instead of the dynamic product created and some other stuff

So am i right that to use product options inventory you have to have a PRODUCT in the database as well as the options even though i don't need inventory on the main product its self???

Offline

 

#19 02-20-2009 20:33:39

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Static Pages & Inventory

You're right, Charlie... when you use the CGI add, it does pull the product name and number from the DB.  My bad.  I did a mod to my remote add routine that allowed me to include a product reference string.  With that approach, I was able to trick the cart into thinking they were DB items, but I still never tried interacting with inventory, so I don't know how that part would work.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#20 02-20-2009 20:40:34

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Static Pages & Inventory

Another thought here... DB products use the optionsel_id value in the hidden field for the option so the cart could know what inventory to adjust.  Remote products do not use that (and the subroutine wouldn't process it) so there really is no way to tie the remote options to a database inventory.  I think you're looking at a pretty major rewrite of your mod if you need inventory control... it would have to somehow tie into existing products and options in the DB rather than using the remote functionality.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#21 02-20-2009 22:50:41

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Static Pages & Inventory

Hi,

I think I have it sorted- thanks to u both.

I changed a few thing in the cart.pl

Code:

} elsif ($sel_pricech eq "D" && $sel_recur > "0") {

$cart_amtrecur = ($cart_amtrecur - $sel_recur);

###added here 21022009 for inventroy contol of product options for remote add to cart  plus see line 1913

 } ######### End of if statement.

if ($inv eq "Y") {

$cart_prodoptionsinv .= "$sel_id, ";


### eof mod 21022009


} ######### End of if statement.

} ######### End of if statement.

#########
######### If we have a multiple select type field, we do some calculations
######### on the selection criteria.
#########

this is for only select boxes - works ok on the inventory side - I am still testing.

also - not sure if this helped but changed this too and made a new hidden post on the static page for it

Code:

######### This routine formulates the data needed to add an item
######### to the shopping cart that was posted via the cart api (non
######### cgi.
#########

my $row = "";
my $line = "";
my $field_value = "";
my @field_value = ();

#$cart_prodid = "";    changed to below amd added  <input type="HIDDEN" name="prod_number" value="(CGIVAR)muse_mod_id(/CGIVAR)"> in  user page ste_teeshirtgen_purchase
                       #### to help with remote cart options inventory 21022009 (this might help with remote cart add and shipping calcs. see line 2292

$cart_prodid = $q->param('prod_number'); # changed here 21022009
$cart_amtstateprovtax = "0.00";

in HTML i put

<input type="HIDDEN" name="prod_number" value="(CGIVAR)muse_mod_id(/CGIVAR)">

thanks again to you both - I will let you know how the testing goes.

Last edited by celdirect (02-20-2009 22:54:20)

Offline

 

Board footer