Jump to content

Want to change the Manufacturer to condition.


Ian

Recommended Posts

Hello:

I do not need the manufacturer as I do not use it, but I would like to add condition, ie what condition is the product in? new, used, good, superb.  etc.  Can this be done fairly easily?

Thank you in advance.

Ian

Link to comment
Share on other sites

In products.index.php:

Find:

            <option value="new" {if $PRODUCT.condition == 'new'}selected="selected"{/if}>{$LANG.catalogue.condition_new}</option>
            <option value="used" {if $PRODUCT.condition == 'used'}selected="selected"{/if}>{$LANG.catalogue.condition_used}</option>
            <option value="refurbished" {if $PRODUCT.condition == 'refurbished'}selected="selected"{/if}>{$LANG.catalogue.condition_refurbished}</option>

Change to:

{foreach from=$CONDITIONS item=condition}
<option value="{$condition@key}"{if $PRODUCT.condition == $condition@key} selected="selected"{/if}>{$condition}</option>
{/foreach}

In products.index.inc.php:

Find:

$page_title = (isset($_GET['action']) && strtolower($_GET['action']) == 'edit') ? $lang['catalogue']['title_product_update'] : $lang['catalogue']['title_product_create'];

Add after:

// List Conditions
$smarty_data['list_conditions'] = array (
  'new' => $lang['catalogue']['condition_new'],
  'used' => $lang['catalogue']['condition_used'],
  'refurbished' => $lang['catalogue']['condition_refurbished'],
);
$GLOBALS['smarty']->assign('CONDITIONS', $smarty_data['list_conditions']);

Now, we can use a hook to add more conditions:

In admin, Manage Hooks, Code Snippets tab, click Add Snippet.

When the page gets displayed again, fill out the form below the list of existing snippets.

Enabled: checked
Unique ID: addConditions@cc62+
Execution Order: 1
Description: Create more inventory condition terms.
Trigger: admin.product.pre_display
Version: 1.0
Author: https://forums.cubecart.com/topic/56698-want-to-change-the-manufacturer-to-condition/
PHP Code:
<?php
// Maximum 25 characters as key ---+
//                                 |
//                                 V
$smarty_data['list_conditions']['helpful'] = "Helpful";
$GLOBALS['smarty']->assign('CONDITIONS', $smarty_data['list_conditions']);

Save the snippet and clear CubeCart's cache.

When adding or editing a product, the new terms will appear in the drop-down.

Next, the language-specific phrase needs to be added. Be back with instruction on how to do that.

Link to comment
Share on other sites

Thank you!

Up to this point, the code works fine, but when I go to the live product on the store, the condition does not show up!  I am using the Mican skin, so that might be a problem?  Or is the phrase that needs to be added where this will get fixed?

Ian

Link to comment
Share on other sites

Got called away. Sorry.

It turns out that the admin section uses some phrases found in the 'catalogue' group (developed in CC6), while the storefront uses similar phrases found in the 'common' group (developed in CC5).

So,  to solve using the new phrases equally, please modify the snippet just created as follows, and create a second snippet as follows:

== Changed Snippet ==
Enabled: checked
Unique ID: addConditions.Pt1@cc62+
Execution Order: 1
Description: Create more inventory condition terms - part 1.
Trigger: admin.product.pre_display
Version: 1.0
Author: https://forums.cubecart.com/topic/56698-want-to-change-the-manufacturer-to-condition/
PHP Code:
<?php
// Maximum 25 characters as key ---+
//                                 |
//                                 V
$smarty_data['list_conditions']['helpful'] = "Helpful";
$GLOBALS['smarty']->assign('CONDITIONS', $smarty_data['list_conditions']);
$GLOBALS['language']->addStrings(array('catalogue' => array('condition_helpful' => "Helpful")));

== New Snippet ==
Enabled: checked
Unique ID: addConditions.Pt2@cc62+
Execution Order: 1
Description: Create more inventory condition terms - part 2.
Trigger: class.catalogue.product_data
Version: 1.0
Author: https://forums.cubecart.com/topic/56698-want-to-change-the-manufacturer-to-condition/
PHP Code:
<?php
$GLOBALS['language']->addStrings(array('common' => array('helpful' => "Helpful")));

 

Link to comment
Share on other sites

bsmither:

Again, this is all good and fine, but the condition does not show up on the product page.  As I mentioned before, I am using the mican Skin, I see that it works in the Foundation skin, but it is at the bottom of the second page, and not useful there.  I would really like to see it on the first page of the Product Details on the mican skin, right after the product name, and just before the Description.   And again on the shop by category page, right after the description of each product.

Thank you

Ian 

Link to comment
Share on other sites

Ok, so I read what you said as "not showing" as something that should have shown next to a "Condition:" label.

It seems Mican was never coded to actually display this product detail.

In Mican's content.product.php, find:

	<div id="product_detail">
	  <h2>{$PRODUCT.name}</h2>

Add after:
      <h3>This product is: {$PRODUCT.condition}</h3>
In content.category.php, find:

	<p class="description">{$product.description_short}</p>

Change to:

	<p class="description">{$product.description_short}</p>
	<p class="description">This product is: {$product.condition}</p>

 

Link to comment
Share on other sites

  • 11 months later...
On 2/21/2021 at 2:07 AM, bsmither said:

Got called away. Sorry.

It turns out that the admin section uses some phrases found in the 'catalogue' group (developed in CC6), while the storefront uses similar phrases found in the 'common' group (developed in CC5).

So,  to solve using the new phrases equally, please modify the snippet just created as follows, and create a second snippet as follows:

== Changed Snippet ==
Enabled: checked
Unique ID: addConditions.Pt1@cc62+
Execution Order: 1
Description: Create more inventory condition terms - part 1.
Trigger: admin.product.pre_display
Version: 1.0
Author: https://forums.cubecart.com/topic/56698-want-to-change-the-manufacturer-to-condition/
PHP Code:
<?php
// Maximum 25 characters as key ---+
//                                 |
//                                 V
$smarty_data['list_conditions']['helpful'] = "Helpful";
$GLOBALS['smarty']->assign('CONDITIONS', $smarty_data['list_conditions']);
$GLOBALS['language']->addStrings(array('catalogue' => array('condition_helpful' => "Helpful")));

== New Snippet ==
Enabled: checked
Unique ID: addConditions.Pt2@cc62+
Execution Order: 1
Description: Create more inventory condition terms - part 2.
Trigger: class.catalogue.product_data
Version: 1.0
Author: https://forums.cubecart.com/topic/56698-want-to-change-the-manufacturer-to-condition/
PHP Code:
<?php
$GLOBALS['language']->addStrings(array('common' => array('helpful' => "Helpful")));

 

I have a dumb question, where do I input the new conditions? When I go to edit/create a new product in the dropdown i just see "helpful" added.

Link to comment
Share on other sites

The key 'helpful' and the phrase "Helpful" was meant as a general example.

Add as many key/phrases as you want, replicating the relevant statements, directly in the snippet code (there is no admin panel available to do this):

'flat' "Crushed"
'boom' "Fully Exploded"
'niub' "New in Unopened Box"
'minripd' "Slightly Torn"

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...