Ian 0 Posted February 19 Share Posted February 19 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 Quote Link to post Share on other sites
bsmither 1,463 Posted February 19 Share Posted February 19 CubeCart already has New, Used, Refurbished. It is just a bit tricky to add other item conditions, but it has been done. Quote Link to post Share on other sites
Ian 0 Posted February 19 Author Share Posted February 19 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? Quote Link to post Share on other sites
Tony 3 Posted February 19 Share Posted February 19 (edited) 4 hours ago, Ian said: OK, how is that done then? When you add/edit a product, it's on there (well, it is on my v6.4.2 install) Edited February 19 by Tony 1 Quote Link to post Share on other sites
bsmither 1,463 Posted February 19 Share Posted February 19 In order to add custom condition words, we need to make a few core code edits, then we can use a Code Snippet to actually add the custom words. I will have instructions soon. 2 Quote Link to post Share on other sites
bsmither 1,463 Posted February 21 Share Posted February 21 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. Quote Link to post Share on other sites
Ian 0 Posted February 21 Author Share Posted February 21 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 Quote Link to post Share on other sites
bsmither 1,463 Posted February 21 Share Posted February 21 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"))); Quote Link to post Share on other sites
Ian 0 Posted February 21 Author Share Posted February 21 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 Quote Link to post Share on other sites
bsmither 1,463 Posted February 21 Share Posted February 21 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> Quote Link to post Share on other sites
Ian 0 Posted February 21 Author Share Posted February 21 bsmither Excellent! Thank you very much! I changed the 'This product is:' to 'Condition:' as it makes more sense, but yes, that works perfectly, and it is in the right spot as well! Ian Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.