Jump to content

Resolved - Product page changes


palex71

Recommended Posts

On a product page, how can I:

 

1) Change the term "Product Code" to something else

2) Remove the Stock Level indication

 

Also, how can I make the search field larger?

 

I have looked in the various .php files, but some changes I attempted did not affect things.

 

Thanks!

 

Link to comment
Share on other sites

In admin Languages, click the edit icon for the language you wish to change the phrase. On the new page, select Catalogue from the drop down. On the new page, scroll to product_code and enter the phrase you want.

 

In admin Store Settings, Stock tab, set Show stock levels to a red cross.

Link to comment
Share on other sites

Thanks... the first solution worked.  However, in Store Settings --> Stock, the "Show stock levels" was already set to a red cross, yet the level is still shown.

 

Did you also have an idea on how to make the search field larger?

 

Thanks again!

Link to comment
Share on other sites

Search field: common.css

find #quick_search (near line 86): change width to 420px;

find #quick_search span.search > input: change width to 300px;

 

Interesting that stock levels still show when the setting is a red cross. This is the statement in the skin file content.product.php:

{if $PRODUCT.stock_level}<p>{$LANG.catalogue.stock_level}: {$PRODUCT.stock_level}</p>{/if}

This is the code that determines stock_level in Catalogue class, displayProduct() function (near line 175):

if((bool)$GLOBALS['config']->get('config', 'stock_level')) {
  $product['stock_level'] = ($stock_level>0) ? $stock_level : 0;
} else {
  $product['stock_level'] = false;
}

Please check your files for this code.
Link to comment
Share on other sites

At the bottom of the file content.product.php, add {debug}. Then view a product.

 

A Debug window will pop up. Near the bottom of the list in the left pane, find the variable PRODUCT. In the right pane, find the array key 'stock_level' and its value.

 

If the skin is showing Stock Level: ##, then the value must be ##. Then there is something about the PHP code that is either getting overwritten, or the admin display of the red cross is wrong.

Link to comment
Share on other sites

This is code relevant to CC521:

 

Then there is something about the PHP code that is either getting overwritten, not set, or the admin display of the red cross is wrong.

 

Remove the {debug}, you won't need it anymore.

 

In the file /class/catalogue.class.php, displayProduct() near line 175, scroll down to the area of line 216.

 

Here we see that the product's "Use Stock Level" setting must be true so that the next test, "Store Setting: Show Stock Levels" can set the 'stock_level' value to false (which will inhibit its display).

 

If the product can be sold regardless of its stock level, that is to say, the product's master "Use Stock Level" is false, then the 'stock_level' key is never set to false and the stock level will always be displayed -- until the stock level reaches zero, where {if $PRODUCT.stock_level} evaluates to false as well.

 

I think having the "Show Stock Levels" test being nested inside the product's "Use Stock Level" test is wrong.

 

Code for CC522 seems to be different. I'm looking at it now.

Link to comment
Share on other sites

I don't quite see where the Use Stock Level is actually set.  Here is the code:
 
 
                                if ((bool)$product['use_stock_level']) {
                                        // Get Stock Level
                                        $stock_level = $this->getProductStock($product['product_id']);
 
                                        if((bool)$GLOBALS['config']->get('config', 'stock_level')) {
                                                $product['stock_level'] = ($stock_level>0) ? $stock_level : 0;
                                        } else {
                                                $product['stock_level'] = false;
                                        }
 
 
                                        if ((int)$stock_level <= 0) {
                                                // Out of Stock
                                                if (!$GLOBALS['config']->get('config', 'basket_out_of_stock_purchase')) {
                                                        // Not Allowed
                                                        $allow_purchase = false;
                                                        $out = true;
                                                }
                                        }
                                }
Link to comment
Share on other sites

"I don't quite see where the Use Stock Level is actually set."

 

On the admin's Add/Edit Product screen is a setting to "Use stock level". This setting, (1 or 0) is in the database table CubeCart_inventory, and is tested with:

if ((bool)$product['use_stock_level'])

 

CC515 has what I think is a bad nesting of the tests. CC521 still has it, but completely ruins the result when looking for stock levels of product option combinations (large blue vs. small red). CC522 seems to have untangled the mess.



For CC515, find near line 286:

$GLOBALS['smarty']->assign('PRODUCT', $product);

 

Add above that:

$product['stock_level'] = ($GLOBALS['config']->get('config', 'stock_level')=='1') ? $product['stock_level'] : false;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...