If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / “Products marked with *** are out of stock.” Logic Error...

“Products marked with *** are out of stock.” Logic Error...

Locked

Started by hedron on 15 Sep 2009, 6:45 AM · Views: 1,947

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
15 Sep 2009, 6:45 AM
#1
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #1 by hedron

When a customers orders an amount that is above the available in stock they get this error message:

“Products marked with *** are out of stock.”

This statement is inaccurate, since it shows up also when items are in stock, but customers orders over the amount in stock.

Is there a way (or a mod) for the system to tell the customer by how much they are over stock (ordered minus stock), so that they can manually fix the order quantity?

Thank you.

ZC Version 1.3.8a

16 Sep 2009, 1:15 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #2 by ajeh

You could either customize the function used to display the *** in the functions_lookup.php file:

  function zen_check_stock($products_id, $products_quantity) {

Or, customize the template with the function:

  function zen_get_products_stock($products_id) {

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Sep 2009, 7:13 PM
#3
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #3 by hedron

Thank you for your reply. :smile:

Note: I am not familiar with php programming, other than simple modifications by looking at others' code.

First of all, which templates should be modified?

When I search for STOCK_MARK_PRODUCT_OUT_OF_STOCK I find the following:

functions_lookups.php
checkout_confirmation.php
shopping_cart.php
paypal_functions.php
paypaldp.php
paypalwpp.php

All of them?

Thanks.

16 Sep 2009, 7:22 PM
#4
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #4 by hedron

Also, I am guessing there is no template override for this....?

Here is one of the functions you mentioned:

  function zen_check_stock($products_id, $products_quantity) {
    $stock_left = zen_get_products_stock($products_id) - $products_quantity;
    $out_of_stock = '';

    if ($stock_left < 0) {
      $out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
    }

    return $out_of_stock;
  }

If I read this right, the function already calculates the amount over. So it is the return that needs to be modified.
Right?

16 Sep 2009, 7:27 PM
#5
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #5 by hedron

First of all, which templates should be modified?

I'll answer myself on this one: Just the one Ajeh mentioned (functions_lookups.php). The stock_left return is specified only there.

16 Sep 2009, 7:40 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #6 by ajeh

NOTE: $stock_left is how much stock is left after taking the current stock and subtracting how much the customer has set in the cart ...

If you want to say how much stock is available before the calculation is made, that is what the function zen_get_products_stock is for ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Sep 2009, 7:58 PM
#7
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #7 by hedron

Yes, I think I prefer going in that direction.

So, for the return logic to be correct, the system would have to mark the available stock for each item within the shopping cart, along with giving a general error message at the top.

General error (at top):
Please adjust your order quantity for the products marked with *
Otherwise items not in stock will be placed on backorder.

Item error:
*Cool item description here

**Available in stock: X

(including line breaks, instead than having *** attached to the description)

So I would have to edit two lines (piece of cake), and add a custom function within the item (clueless).

What do you think of the logic as described above, better? Still flawed in some way?

Thank you :smile:

16 Sep 2009, 8:11 PM
#8
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #8 by hedron

Or not allow backordering at all and use the current sentence in place "Products marked with *** are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (
*). Thank you"

So, after after clearing up my thoughts above, here is the revised question:

How do I insert the In Stock quantity within the shopping cart, either below the description or below the ordered quantity?

16 Sep 2009, 8:25 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #9 by drbyte

This might save you some trouble, since that message already exists, but only displays if you set Admin->Configuration->Stock->Allow Checkout Out Of Stock? to false.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Sep 2009, 8:32 PM
#10
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #10 by hedron

Right right. I changed that settings and found that message.

In any case the last question still stands. How do I show In Stock within the shopping cart?

The customer would have no idea what to change the quantity to unless they go back to the catalog, or not at all if the In Stock is not displayed in the catalog (which is not in my case, for several reasons)

16 Sep 2009, 8:36 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #11 by drbyte

That's not a one-line change. Basically you need to find the code that builds the data that gets sent to the template file, and augment it with the additional info you want to show. Off the top of my head I'd guess at the shopping_cart/header_php.php and main_template_vars.php file and the shopping_cart.php class, and maybe others.
Ajeh already said how to get the number:> Ajeh:

If you want to say how much stock is available ... that is what the function zen_get_products_stock is for ...

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Sep 2009, 8:40 PM
#12
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #12 by hedron

I guess that is way over my coding abilities (minimal), so I will have to leave that to someone else.

Is there a place where to suggest Add Ons?

Thank you.

16 Sep 2009, 8:42 PM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #13 by drbyte

hedron:

Is there a place where to suggest Add Ons?
There's a "Commercial Help Wanted" area where you can post request for quotes on paid work you'd like done for you. You can find it on the forum home page.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Sep 2009, 8:55 PM
#14
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Post #14 by hedron

Thanks.

For what is worth, for now I changed the wording to something more reflective of what I mean:

For products marked with * you ordered more items than available in stock.
Please change your order quantity, otherwise items not in stock will be placed on backorder.

:mellow: