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.

#26 09-18-2017 11:37:19

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

Re: Local Inventory Oversell to change to Preorder

sdn wrote:

I have finally had some time to get my head around this mod. What is the intended function of invpurchord column? Could we use that for the pre-order quantities rather than adding a new column? That would work better if Quickbooks was driving the inventory levels as it tracks inventory we have on order with suppliers. Is the new Quickbooks interface available now?

The intended function of the invpurchord column is to hold/report inventory on purchase order.  It works hand-in-hand with the purchase order system in K9 under the Store / Inventory menu.  You could load your purchase orders into K9 and that would increment that field properly.  The QB module is ready (desktop QB, not online yet) and works great hand-in-hand with all this.


Nick Hendler

Online

 

#27 09-18-2017 11:52:09

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Local Inventory Oversell to change to Preorder

Hi Simon,

invpurchord is the inventory on purchase order in the system - I have thought about going back and using this col - my only concern with that, in our case some items are on long lead time so they may be on order but they are not going to arrive in the time scale we would be comfortable with a pre order situation. Also it is the total on purchase order and would show 30 units if there are 10 arriving in a week and 20 in 2 months time.

If those issues are not a concern then it looks to me like a very good target to repurpose.

Rob

Offline

 

#28 04-24-2018 02:54:29

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 874

Re: Local Inventory Oversell to change to Preorder

We have noticed that the above mod does not work correctly where a product page has more than one inventory item and the first item is in stock and the others are preorder. They all show as in stock.

If I understand the mod code correctly, "$invlevel = ($proddisp['xpricemap'][$first_key]['xinvid']['invlevel']);" uses the inventory level of the first_key only to determine the instock or preorder status.

How can we make the code determine the stock status for each inventory item individually? Or is that getting horribly complicated. It is already horribly complicated as it is...

Last edited by sdn (04-24-2018 02:56:40)


Simon

Offline

 

#29 04-24-2018 05:12:58

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Local Inventory Oversell to change to Preorder

Hi Simon

Like most mods, this one is the quickest route to what we needed at the time - in our case we only have single inventory item product offers - some of which have add in accessories. To keep things simple we only use the pre-order system on the single inventory item product offers and not for any of the accessories.

Its a while since I did this mod, but from memory, in the $proddisp array, xpricemap will be an array of all the inventory items in the product offer so the inventory level for each item will be in that array - ['xinvid']['invlevel'].

Need to add a "foreach" and cycle through the array looking at the inventory level for all inventory items - also need to look at the invoversell levels for each item - which can be done in the same loop through - and from those values figure out if you are switching to pre-order together with the quantity allowed for pre-order.

I never liked that first key thing - I will try to get back in a bit with some modified code - but can't promise anything.

Offline

 

#30 04-25-2018 02:02:12

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 874

Re: Local Inventory Oversell to change to Preorder

Hi Rob

Thanks for your reply. I will try to reboot my CCP programming head. I managed to get a handle on quite a bit of v8 but v9 has befuddled me.

For example, the inventory item options display check boxes - is there documentation on how these work Nick? I have assumed that if an inventory item is a standalone product with no other options thent both boxes are left unchecked? Do they impact the mod code we would need?

Nick, please can you give us an idea of what we need to use in the for loop to get the stock status of individual inventory items on a product page?

Simon

Last edited by sdn (04-25-2018 04:13:44)


Simon

Offline

 

#31 04-25-2018 08:36:12

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

Re: Local Inventory Oversell to change to Preorder

The main product offer display is generated the prodshow.php file in {private}/apps/ecom/ECOM/includes.  The main product offer display was changed a whole lot in K9 versus what was done in V6 through V8.  Basically, prodshow.php loads, then will load the following includes:

pricedisp.php: Pricing (has inventory display)
prodshowimg.php: Product offer images
prodshowextras.php: Product offer extra info (social buttons, review link, videos, etc)
icondisp.php: Icon display

Then, depending on the offer type, one of these:

prodaddcart_servoptdl.php: Service/Download Offers - no inventory
prodaddcart_invitems.php: Inventory Item Offers
prodaddcart_invopts.php: Custom Package Offers (select from groups of inventory items)
prodaddcart_packagedeal.php: Package Deal Offers (multiple inventory item bundle deal)

The above files will load pricedisp.php, and the following, if necessary, depending on offer/display type:

prodaddcart_select.php: Inventory items selection using selection list
prodaddcart_radio.php: Inventory items selection using radio buttons
prodaddcart_quanmult.php: Inventory items multiple quantity input box entry
prodaddcart_checkbox.php: Inventory items selection using checkboxes
prodaddcart_quantity.php: Single quantity input
prodaddcart_autoprice.php: Auto pricing display (ajax)
prodaddcart_options.php: Options display for an offer or inventory item

Prodshow then finishes up by running:

prodaddcart_xaddons.php: If addons are found
prodaddcart_notifystock.php: If stock notifications are active

Additional product offer related files which will use pricing displays, show inventory, and possibly add to cart buttons:

prodlistitem.php: Product offer default category list item
catfeatgriddetail.php: Product offer category feature grid item

###

With the above having been said, if you want a full on solution that handles every offer type, this mod would need to be done differently.  This mod is basically to the overlying prodshow.php display, and attaches to the prodlistitem.php and catfeatgriddetail.php displays.  It's basically only good for service/download offers and inventory item offers containing only a single inventory item choice.  It's working off the first inventory item seen for the product offer, and basing everything on that, assuming that there are no more inventory items that matter in the offer.

Where you see Rob write:

Code:

reset($proddisp);
$first_key = key($proddisp['xpricemap']);

Then he explicitly tags the first inventory item found in the pricemap for the product offer:

Code:

$proddisp['xpricemap'][$first_key]...

Instead of bothering with that, you could loop through all pricemap entries (which would be inventory items, and have an array for their 'xinvid' key for all but service/download offers):

Code:

foreach ($proddisp['xpricemap'] as $pricemapid => $pricemapentry) {

     if ((empty($pricemapentry['xinvid'])) || (!(is_array($pricemapentry['xinvid'])))) {continue;}

     $inventoryitem = $pricemapentry['xinvid'];

     if (($inventoryitem['invlevel'] <= 0) && ($inventoryitem['invoversell'] > 0)) {}

} // End of foreach statement.

Nick Hendler

Online

 

#32 04-29-2018 05:14:03

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Local Inventory Oversell to change to Preorder

Hi Nick,

Thanks for a very detailed explanation of exactly what is involved in the K9 product display - very useful.

This mod developed out of the OP's comment, "I don't sell in Package and or Choices. Its straight forward one inventory item." - which matched the situation we were looking at for a range of products.

I always thought it would be a lot of effort to expand this up to a full on solution that handles every offer type. The really detailed explanation of how prodshow.php works shows what needs to be handled and followed through into the other files. That said, Nick's code is a really great starting place to expand this for service/download and inventory item offers. The "foreach" is a really nice breakout of each inventory item.

At the inventory item level there are 5 variables that play a part in the logic and calculation of In-Stock/Pre-Order and the available level.

The following code pulls this out.

Code:

foreach ($proddisp['xpricemap'] as $pricemapid => $pricemapentry) {

     if ((empty($pricemapentry['xinvid'])) || (!(is_array($pricemapentry['xinvid'])))) {continue;}
     
     $inventoryitem = $pricemapentry['xinvid'];
     
     $invlevel      = $inventoryitem['invlevel'] // Local inventory level
     
     $invoversell   = $inventoryitem['invoversell'] // Oversell level for the item
     
     $invsaleorder  = $inventoryitem['invsalesorder'] // Items sold not yet shipped
     
     $preorder      = $inventoryitem['preorder'] // The new column we added to switch an item between regular use of oversell and pre-order use of oversell
     
     $newstockarr   = $inventoryitem['newstockarr'] // The new column we added to display new stock arrival information.
     
     if ( something) { do something }

} // End of foreach statement.

I think the logic for the following displays will be the same:-

Inventory items selection using selection list
Inventory items selection using radio buttons
Inventory items multiple quantity input box entry
Inventory items selection using checkboxes

With the Pre-Order status determined by each individual item.

For:-

Single quantity input

If it really is a single inventory item then I believe this is the same case as all the others - If the offer could be a package of more than one inventory item, then the code needs to take care of finding the lowest inventory plus oversell level and the longest lead time in order to give the right answer. This will automatically work for a single inventory item.

modifications are going to be needed in at least:-

pricedisp.php
prodshow.php
prodlistitem.php
catfeatgriddetail.php

I think it should be possible to handle most of the "select item displays" with modifications to pricedisp.php alone - it is for "Radio Buttons" but have not looked at the others.

An issue for the various "select item displays" would be, the individual items displaying In-Stock or Pre-Order correctly via pricedisp.php then what to do with the Add to Cart button (from prodshow.php) lower on the product page display? I guess that has to have 3 values:-

Add-to-Cart                      - all items are available
Add-to-Cart/Pre-Order  - some items are on Pre-Order
Pre-Order                         - all items are on Pre-Order

Quite a lot to take care of but probably less than I originally thought.

Still only covers service/download and inventory item offers.

Rob

Last edited by robprotronica (04-30-2018 02:13:51)

Offline

 

#33 04-30-2018 08:01:51

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

Re: Local Inventory Oversell to change to Preorder

Great feedback, Rob.  To address a few things:

pricedisp.php:  Handles ALL pricing, points and inventory displays (except stock notification) for all items in product lists, category feature grids and product details. 
prodaddcart_notifystock.php: Has an inventory display.

You really need to look at ECOM::buildprodoffers() to see how the offers (referenced individually in displays as $proddisp) are built.  There's an 'invdisp' key on the offer level that might be useful.  Contains the calculated inventory summary for all items.  Other enlightening information there too.

Basically this is a mod to change the name of the Add to Cart button (prodlistitem.php, catfeatgriddetail.php, prodshow.php), and to change the inventory display (pricedisp.php, maybe prodaddcart_notifystock.php).  Modding correctly in these four or five files would handle all offer types without messing with anything else.  They mods you posted would need to be modified to recognize the count of items in $prodisp['xpricemap'], whether they are inventory items or not ('xinvid' key will either be blank for a service item, or an inventory item array with all the inventory item's info), and loop through them, rather than grabbing the first key.


Nick Hendler

Online

 

#34 05-01-2018 03:36:25

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 874

Re: Local Inventory Oversell to change to Preorder

Thanks to you both for all the additional information. It will take me a while to work my way through it and see if I can implement it for our needs. Will let you know how I get on.


Simon

Offline

 

Board footer