View Single Post
  #29  
Old 09-26-2003, 07:30 PM
 
eleven eleven is offline
 

Senior Member
  
Join Date: Nov 2002
Location: Charlotte, NC, USA
Posts: 118
 

Default Solution for 3.4.4

Here's my upgrade of FunkyDunk's mod to version 3.4.4. There were problems with the extra line break, the use of other languages, and it handled the icon using the old image method. This will correct all of those.

replace /skin1/admin/main/category_modify.tpl with this:
Code:
{* $Id: category_modify.tpl,v 1.24 2003/01/10 13:14:49 svowl Exp $ *} <script language="javascript"> window.name="catmodwin"; </script> {include file="main/popup_image_selection_js.tpl"} {include file="location.tpl" last_location="Add/Modify category"} {capture name=dialog} <table border=0> <form name="addform" action="category_modify.php?mode={$smarty.get.mode}" method=post enctype="multipart/form-data"> <tr> <td>[img]../icon.php?categoryid={$cat}&rand={$rand}{if $file_upload_data.file_path}&tmp=y{/if}[/img]</td> <td></td> <td> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr><td align=center> <input type=button value="Change icon" onclick="popup_image_selection('C', '{$cat}', '{$query_string}');"> <input type=button value="Delete icon" onclick="javascript:self.location='category_modify.php?mode=delete_icon&cat={$cat}'"> </td></tr> {if $file_upload_data.file_path} <tr><td align=center> <p align=justify> Press "Submit" button below, please, to apply this image for the category </td></tr> {/if} </table> </td> </tr> <TR> <TD height="10" class=FormButton nowrap>Orderby</TD> <TD width="10" height="10"></TD> <TD height="10"><INPUT type=text name="order_by" size=4 value="{if $category_error ne ""}{$smarty.post.order_by}{elseif $smarty.get.mode ne "add"}{$current_category.order_by}{/if}"> </TR> <tr> <td height="10" class=FormButton nowrap>Category</td> <td width="10" height="10"><font class=CustomerMessage>*</font></td> <td height="10"> <input type="text" name="category_name" size="30" value="{if $category_error ne ""}{$smarty.post.category_name|escape:"htmlall"}{elseif $smarty.get.mode ne "add"}{$current_category.category|escape:"htmlall"}{/if}"> {if $category_error ne ""} <font color=red>&lt;&lt; Wrong value</font> {/if} </td> </tr> <tr> <td height="10" class=FormButton nowrap valign=top>Description</td> <td width="10" height="10"><font class=CustomerMessage></font></td> <td height="10"> <textarea cols=65 rows=15 name=description> {if $category_error ne ""}{$smarty.post.description|escape:"htmlall"}{elseif $smarty.get.mode ne "add"}{$current_category.description|escape:"htmlall"}{/if} </textarea> </td> </tr> {* funkydunk metamod 2003 *} <tr> <td height=10 class=FormButton nowrap>Page Title</td> <td width="10" height="10"><font class=FormButtonOrange></font></td> <td height=10> <input type=text name=page_title size="30" value="{if $category_error ne ""}{$smarty.post.page_title|escape:"htmlall"}{elseif $smarty.get.mode ne "add"}{$current_category.page_title|escape:"htmlall"}{/if}"> </td> </tr> <tr> <td height=10 class=FormButton nowrap>Meta Description</td> <td width="10" height="10"><font class=FormButtonOrange></font></td> <td height=10> <input type=text name=meta_description size="30" value="{if $category_error ne ""}{$smarty.post.meta_description|escape:"htmlall"}{elseif $smarty.get.mode ne "add"}{$current_category.meta_description|escape:"htmlall"}{/if}"> </td> </tr> {* end of funkydunk metamod 2003 *} <tr> {* funkydunk metamod 2003 *} <td height=10 class=FormButton nowrap>Meta Keywords</td> {* end of funkydunk metamod 2003 *} <td width="10" height="10"><font class=FormButtonOrange></font></td> <td height=10> <input type=text name=meta_tags size="30" value="{if $category_error ne ""}{$smarty.post.meta_tags|escape:"htmlall"}{elseif $smarty.get.mode ne "add"}{$current_category.meta_tags|escape:"htmlall"}{/if}"> </td> </tr> <TR> <TD height=10 class=FormButton nowrap>Membership</TD> <TD width=10 height=10><FONT class=FormButtonOrange></FONT></TD> <TD height=10> <SELECT name=cat_membership> <OPTION value=""{if $current_category.membership eq ""} selected{/if}>All</OPTION> {section name=mi loop=$membership_levels} {if $membership_levels[mi].usertype eq "C"} <OPTION value="{$membership_levels[mi].membership}"{if $current_category.membership eq $membership_levels[mi].membership} selected{/if}>{$membership_levels[mi].membership}</OPTION> {/if} {/section} </SELECT> </TD> </TR> <tr> <td height=10 class=FormButton nowrap>Availability</td> <td width=10 height=10><font class=CustomerMessage></font></td> <td height="10"> <select name=avail> <option value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>Enabled</option> <option value='N' {if ($current_category.avail eq 'N')} selected {/if}>Disabled</option> </select> </td> </tr> <tr> <td width="78" class=FormButton></td> <td width="10"></td> <td width="282"> <input type=submit value="Submit"> </td> </tr> <input type=hidden name=cat value={$cat}> </form> </table> {/capture} {include file="dialog.tpl" title="Add/Modify category" content=$smarty.capture.dialog extra="width=100%"} {if $smarty.get.mode ne "add" and $cat and ($category_languages ne "" or $other_languages)} {include file="admin/main/category_lng.tpl"} {/if}

replace /admin/category_modify.php with this:
Code:
<? /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2002 Ruslan R. Fazliev. All rights reserved. | +-----------------------------------------------------------------------------+ | The Ruslan R. Fazliev forbids, under any circumstances, the unauthorized | | reproduction of software or use of illegally obtained software. Making | | illegal copies of software is prohibited. Individuals who violate copyright | | law and software licensing agreements may be subject to criminal or civil | | action by the owner of the copyright. | | | | 1. It is illegal to copy a software, and install that single program for | | simultaneous use on multiple machines. | | | | 2. Unauthorized copies of software may not be used in any way. This applies | | even though you yourself may not have made the illegal copy. | | | | 3. Purchase of the appropriate number of copies of a software is necessary | | for maintaining legal status. | | | | DISCLAIMER | | | | THIS SOFTWARE IS PROVIDED BY Ruslan R. Fazliev ``AS IS'' AND ANY | | EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | DISCLAIMED. IN NO EVENT SHALL Ruslan R. Fazliev OR ITS | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev. | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2002 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: category_modify.php,v 1.41 2002/12/04 08:12:50 matr Exp $ # require "../smarty.php"; require "../config.php"; require "./auth.php"; require "../include/security.php"; x_session_register("file_upload_data"); # # Update category or create new # # # Check for errors # if ($REQUEST_METHOD == "POST" && $mode == "add" && (substr_count($category_name,"/") || empty($category_name))) { # # Error: Category name contains symbol "/" # $smarty->assign("category_error", "1"); } elseif ($REQUEST_METHOD == "POST") { # # International descriptions # if ($mode == "update_lng") { if ($category_lng_code) { foreach ($category_lng_code as $value) { db_query ("UPDATE $sql_tbl[categories_lng] SET description='".$category_lng_description[$value]."', category='".$category_lng_category[$value]."' WHERE code='$value' AND categoryid='$cat'"); } } if ($category_new_description || $category_new_category) { db_query ("INSERT INTO $sql_tbl[categories_lng] (code, categoryid, category, description) VALUES ('$category_new_language','$cat','".$category_new_category."','".$category_new_description."')"); } func_header_location("category_modify.php?cat=$cat&lng_updated"); } # # Images processing # $image_posted = func_check_image_posted($file_upload_data, "C"); $store_in = ($config["Images"]["icons_location"] == "FS"?"FS":"DB"); if ($mode == "add" && !empty($cat) && !substr_count($category_name,"/")) { # # Get id, name and icon of parent category # $category_data = func_query_first("select $sql_tbl[categories].categoryid, $sql_tbl[categories].category, $sql_tbl[icons].image, $sql_tbl[icons].image_path, $sql_tbl[categories].image_x, $sql_tbl[categories].image_y, $sql_tbl[categories].order_by, $sql_tbl[categories].membership, $sql_tbl[icons].image_type from $sql_tbl[categories], $sql_tbl[icons] where $sql_tbl[categories].categoryid='$cat' and $sql_tbl[categories].categoryid=$sql_tbl[icons].categoryid"); if ($category_data) { $parent_categoryid = $category_data["categoryid"]; $parent_category = $category_data["category"]; if (!$image_posted) { if ($store_in == "FS") $image_data["image"] = $category_data["image_path"]; else $image_data["image"] = addslashes($category_data["image"]); $image_data["image_x"] = $category_data["image_x"]; $image_data["image_y"] = $category_data["image_y"]; $image_data["image_type"] = $category_data["image_type"]; } } # # Create new category # db_query("insert into $sql_tbl[categories] (category, description, page_title, meta_description, meta_tags, avail, order_by, membership) values ('".addslashes($parent_category)."/$category_name', '$description','$page_title', '$meta_description', '$meta_tags', '$avail','$order_by','$cat_membership')"); $cat = db_insert_id(); if ($image_posted) $image_data = func_get_image_content($file_upload_data, $cat); db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$parent_category/$category_name/%'"); db_query("update $sql_tbl[categories] set image_x='$image_data[image_x]', image_y='$image_data[image_y]' where categoryid='$cat'"); if ($store_in == "FS") db_query("insert into $sql_tbl[icons] (categoryid, image_path, image_type) values ('$cat', '$image_data[image]', '$image_data[image_type]')"); else db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image_data[image]', '$image_data[image_type]')"); } elseif ($mode == "add" && !substr_count($category_name,"/")) { # # Create new category with root parent # db_query("insert into $sql_tbl[categories] (category, description, page_title, meta_description, meta_tags, avail, order_by, membership) values ('$category_name', '$description','$page_title', '$meta_description', '$meta_tags', '$avail','$order_by','$cat_membership')"); $cat = db_insert_id(); if ($image_posted) $image_data = func_get_image_content($file_upload_data, $cat); db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_name/%'"); db_query("update $sql_tbl[categories] set image_x='$image_data[image_x]', image_y='$image_data[image_y]' where categoryid='$cat'"); if ($store_in == "FS") db_query("insert into $sql_tbl[icons] (categoryid, image_path, image_type) values ('$cat', '$image_data[image]', '$image_data[image_type]')"); else db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image_data[image]', '$image_data[image_type]')"); } else { # # Update existing category name # and all subcategories names # $categories_chain = explode("/",$category_name); $category_path = ""; # # Move category feature # foreach($categories_chain as $category_section) { $category_path .= $category_section; if ($category_path != $category_name && !func_query_first("select * from $sql_tbl[categories] where category='$category_path'")){ db_query("insert into $sql_tbl[categories] (category, description, page_title, meta_description, meta_tags, avail, order_by, membership) values ('$category_path', '$description','$page_title', '$meta_description', '$meta_tags', '$avail','','$cat_membership')"); db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_path/%'"); }; $category_path .= "/"; } $old_category_name = array_pop(func_query_first("select category from $sql_tbl[categories] where categoryid='$cat'")); db_query("update $sql_tbl[categories] set category='$category_name', description='$description',page_title='$page_title', meta_description='$meta_description', meta_tags='$meta_tags', avail='$avail', order_by='$order_by', membership='$cat_membership' where categoryid='$cat'"); db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_name/%'"); db_query("update $sql_tbl[categories] set category=replace(category, '".addslashes($old_category_name)."', '$category_name') where category like '".addslashes($old_category_name)."/%'"); } # # Insert category icon # if ($image_posted) { $image_data = func_get_image_content($file_upload_data, $cat); if ($store_in == "FS") db_query("update $sql_tbl[icons] set image_path='$image_data[image]', image_type='$image_data[image_type]' where categoryid='$cat'"); else db_query("update $sql_tbl[icons] set image='$image_data[image]', image_type='$image_data[image_type]' where categoryid='$cat'"); db_query("update $sql_tbl[categories] set image_x='$image_data[image_x]', image_y='$image_data[image_y]' where categoryid='$cat'"); } func_header_location("category_modify.php?cat=$cat"); } if ($mode == "del_lang") { db_query ("DELETE FROM $sql_tbl[categories_lng] WHERE categoryid='$cat' AND code='$code'"); func_header_location("category_modify.php?cat=$cat&lng_deleted"); } if ($REQUEST_METHOD == "GET" && $mode == "delete_icon" && !empty($cat)) { db_query("UPDATE $sql_tbl[icons] SET image='', image_path='', image_type='' WHERE categoryid='$cat'"); func_header_location("category_modify.php?cat=$cat"); } require "../include/categories.php"; require "./location_ajust.php"; # # Prepare multi languages # $category_languages = func_query ("SELECT $sql_tbl[categories_lng].*, $sql_tbl[countries].country, $sql_tbl[countries].language FROM $sql_tbl[categories_lng], $sql_tbl[countries] WHERE $sql_tbl[categories_lng].categoryid='$cat' AND $sql_tbl[categories_lng].code=$sql_tbl[countries].code"); $int_languages = func_query ("SELECT DISTINCT($sql_tbl[languages].code), $sql_tbl[countries].country, $sql_tbl[countries].language FROM $sql_tbl[languages], $sql_tbl[countries] WHERE $sql_tbl[languages].code=$sql_tbl[countries].code AND $sql_tbl[languages].code!='$config[default_admin_language]'"); $other_languages = array (); if ($int_languages) { foreach ($int_languages as $key=>$value) { $found = false; if ($category_languages) { foreach ($category_languages as $key1 => $lng) { $category_languages[$key1]["description"] = stripslashes($lng["description"]); $category_languages[$key1]["category"] = stripslashes($lng["category"]); if ($lng["code"] == $value["code"]) $found = true; } } if (!$found) $other_languages[] = $value; } } $smarty->assign("int_languages", $int_languages); $smarty->assign("other_languages", $other_languages); $smarty->assign("category_languages", $category_languages); # # Check if image selected is not expired # if ($file_upload_data["counter"] == 1) { $file_upload_data["counter"]++; $smarty->assign("file_upload_data", $file_upload_data); } else { if ($file_upload_data["source"] == "L") @unlink($file_upload_data["file_path"]); x_session_unregister("file_upload_data"); } $smarty->assign("query_string", urlencode($QUERY_STRING)); $smarty->assign("rand", rand()); $smarty->assign("main","category_modify"); $smarty->assign("location",$location); x_session_save(); @include "../modules/gold_display.php"; $smarty->display("admin/home.tpl"); ?>

Of course, if you are not upgrading to 3.4.4 you must still run the SQL commands and make the other changes in FunkyDunk's original post.
__________________
|| E L E V E N ||
Reply With Quote