Jump to content

Want to change the Manufacturer to condition.


Ian
 Share

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

12 hours ago, bsmither said:

CubeCart already has New, Used, Refurbished. It is just a bit tricky to add other item conditions, but it has been done.

OK, how is that done then? 

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="{[email protected]}"{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: [email protected]+
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: [email protected]+
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.[email protected]+
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

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.

 Share

×
×
  • Create New...