X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Duplicate Info From Custom Field (https://forum.x-cart.com/showthread.php?t=68944)

Wazowski 03-28-2014 03:52 PM

Duplicate Info From Custom Field
 
Hi there,

I created a custom text field below Detailed Description to make it easier to display different types of information, it all works fine, but when I select a list of products and go to Modify Selected and check my custom field to get saved for all the rest items, itâ–“s not saving. Where do I missed something?

totaltec 03-31-2014 11:47 PM

Re: Duplicate Info From Custom Field
 
It could be in the template code. Paste your template code Just the section around where you made the change, include the previous field and the following field. I'll take a look.

Wazowski 04-01-2014 10:51 AM

Re: Duplicate Info From Custom Field
 
Thanks for your time Mike!

/1/ Created a new column in xcart_products_lng_en mysql table, called custom_text.


/2/ admin/product_modify.php

$trusted_post_variables = array(
'product_lng',
'descr',
'fulldescr',
'posted_data',
'js_code',
'efields',
'custom_text', /** MY CUSTOM FIELD **/
);


/3/ include/product_modify.php

// Fill all languages by default
$int_descr_data = array(
'productid' => $productid,
'product' => $product,
'descr' => $descr,
'fulldescr' => $fulldescr,
'keywords' => $keywords,
'custom_text' /** MY CUSTOM FIELD **/
);

// Update product/descr/fulldescr/keywords
$int_descr_data = array(
'product' => $product,
'descr' => $descr,
'fulldescr' => $fulldescr,
'keywords' => $keywords,
'custom_text' /** MY CUSTOM FIELD **/
);

// Update international descriptions
$int_descr_data = array();
foreach ($query_data as $k => $v) {
if (in_array($k, array('product', 'descr', 'fulldescr', 'keywords', 'custom_text')))

func_unset($query_data, 'product', 'descr', 'fulldescr', 'keywords', 'custom_text');



/4/ include/product_clone.php

// Update just created product by values from existing product
$query = array();
foreach ($product_info as $k=>$v) {
if (
!is_numeric($k)
&& !in_array($k, array('productid', 'productcode', 'provider', 'add_date', 'views_stats', 'del_stats', 'sales_stats', 'product', 'descr', 'fulldescr', 'keywords', 'custom_text'))
) {
$query[$k] = addslashes($v);
}
}


/5/ skin/common_files/main/product_details.tpl

<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="field[custom_text]" /></td>{/if}
<td colspan="2" class="FormButton">
<div{if $active_modules.HTML_Editor and not $html_editor_disabled} class="description"{/if}>Custom Details 1:</div>
<div class="description-data">
{include file="main/textarea.tpl" name="custom_text" cols=45 rows=12 class="InputWidth" data=$product.custom_text width="100%" btn_rows=4}
</div>
</td>
</tr>

cherie 04-05-2014 04:27 PM

Re: Duplicate Info From Custom Field
 
Why not use Extra Fields?

Wazowski 04-07-2014 10:53 AM

Re: Duplicate Info From Custom Field
 
Quote:

Originally Posted by cherie
Why not use Extra Fields?

Limited number of characters (

cflsystems 04-07-2014 11:19 AM

Re: Duplicate Info From Custom Field
 
You have it coded to save for the product itself but not for when it is multiple products. It is in the same product_modify.php and applies for $geid

cherie 04-07-2014 11:23 AM

Re: Duplicate Info From Custom Field
 
It's far easier to modify Extra Fields to allow more characters than to build your own Extra Fields system.


All times are GMT -8. The time now is 01:04 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.