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)
-   -   Funkydunk's COOL mod for total meta tag control (https://forum.x-cart.com/showthread.php?t=2854)

Cameron 05-24-2003 04:54 PM

Funkydunk's COOL mod for total meta tag control
 
I had Funkydunk do an x-cart customization for my 3.3.5 stores so that I could have total control over the title and meta tags for each category to score higher in the search engines. It works perfectly, and I want to share it with the rest of you. I have no idea if this works in 3.4.0, but it's fine in 3.3.5...3.3.6 will probably work fine too.

First, patch your SQL database with this info:
Quote:

INSERT INTO xcart_config VALUES ('meta_title', 'Meta Title', '', 'Company', 600, 'text');
INSERT INTO xcart_config VALUES ('meta_description', 'Meta Description', 'Offering Dolphin Jewelry, Dolphin Gifts, Dolphin Art, Dolphin Toys,Dolphin Animals and other Dolphin related products.', 'Company', 601, 'text');
INSERT INTO xcart_config VALUES ('meta_keywords', 'Meta Keywords', 'dolphins,dolphin jewelry,dolphin gifts,dolphin art,dolphin toys,dolphin tattoos,dolphin figurine,dolphin home decor,dolphin water fountains,dolphin clothing,dolphin books,dolphin videos,dolphin tote bags', 'Company', 602, 'text');

ALTER TABLE `xcart_categories` ADD `page_title` VARCHAR( 255 ) AFTER `description` ;
ALTER TABLE `xcart_categories` ADD `meta_description` VARCHAR( 255 ) AFTER `page_title` ;


Then replace the <title> tag of your home.tpl with this line, making sure you replace the COMPANYNAME.COM with whatever you want to show after your *product descriptions*
Quote:

<title>{if $main eq "catalog"}{if $location eq ""}{$config.Company.meta_title}{else}{* funkydunk metamod 2003 *}{if $current_category.page_title eq ""}{strip}{section name=position loop=$location start=0 }{if %position.last% eq "true"}{$location[position].0|escape}{/if}{/section}{/strip}{else}{$current_category.page_title}{/if}{* end of metamod *}{/if}{elseif $main eq "product"}{*{$current_category.page_title}:*}{ if $product.product ne ''}{$product.product} - COMPANYNAME.COM{/if}{elseif $main eq "help"}{$lng.txt_subtitle_help}{elseif $main eq "cart"}{$lng.txt_subtitle_cart}{elseif $main eq "checkout"}{$lng.txt_subtitle_checkout}{elseif $main eq "order_message"}{$lng.txt_subtitle_thankyou}{/if}</title>

Next, replace your skin1/admin/main/category_modify.tpl file with this one:
Quote:

{* $Id: category_modify.tpl,v 1.20 2002/11/10 09:26:46 ndv Exp $ *}
{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}[/img]</td>
<td colspan=2></td>
</tr>
<tr>
<td height="10" class=FormButton nowrap>Icon</td>
<td width="10" height="10"></td>
<td><input type="file" name="userfile"></td>
</tr>
<TR>
<TD height="10" class=FormButton nowrap>Orderб═by</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"}{e lseif $smarty.get.mode ne "add"}{$current_category.category|escape:"htmlall" }{/if}">
{if $category_error ne ""}
<font color=red><< 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"}{els eif $smarty.get.mode ne "add"}{$current_category.description|escape:"htmla ll"}{/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"}{else if $smarty.get.mode ne "add"}{$current_category.page_title|escape:"htmlal l"}{/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"}{elsei f $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%"}


Then replace your (store)/admin/category_modify.php file with this:
Quote:

<?
/************************************************** ***************************\
+-----------------------------------------------------------------------------+
| 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";

#
# 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") {

if (func_is_image_userfile($userfile, $userfile_size, $userfile_type)) {
move_uploaded_file($userfile, "$file_temp_dir/$userfile_name");
$userfile = "$file_temp_dir/$userfile_name";

list($image_size, $image_x, $image_y) = func_get_image_size($userfile);

$fd = fopen($userfile, "rb");
$image = addslashes(fread($fd, $image_size));
fclose($fd);

unlink($userfile);
}

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[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 (!func_is_image_userfile($userfile, $userfile_size, $userfile_type)) {
$image = $category_data["image"];
$image_x = $category_data["image_x"];
$image_y = $category_data["image_y"];
$userfile_type = $category_data["image_type"];
$image = addslashes($image);
}
}
#
# 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();

db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$parent_category/$category_name/%'");

db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image', '$userfile_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();
db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_name/%'");
db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image', '$userfile_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, '$old_category_name', '$category_name') where category like '$old_category_name/%'");
}

#
# Insert category icon
#
if (func_is_image_userfile($userfile, $userfile_size, $userfile_type))
db_query("update $sql_tbl[icons] set image='$image', image_type='$userfile_type' where categoryid='$cat'");

header("Location: category_modify.php?cat=$cat");
exit;
}

require "../include/categories.php";

require "./location_ajust.php";

$smarty->assign("usertype",$usertype);
$smarty->assign("rand", rand());
$smarty->assign("main","category_modify");
$smarty->assign("location",$location);

@include "../modules/gold_display.php";
$smarty->display("admin/home.tpl");
?>


Finally, this can replace your meta.tpl file (be warned, I have the editorns.js script called from the root directory instead of the default path meta.tpl comes with. If your store isn't in a directory called (store) then you will want to leave those lines out:
Quote:

{* $Id: meta.tpl,v 1.9 2002/11/19 14:53:27 ndv Exp $ *}
{* funkydunk metamod *}{if $current_category.meta_description ne ""}<META NAME="description" CONTENT="{$current_category.meta_description}">{el se}<META NAME="description" CONTENT="{$config.Company.meta_description}">{/if}{* end of funkydunk metamod *}
{if $current_category.meta_tags ne ""}
<META NAME="keywords" content="{$current_category.meta_tags}">
{* funkydunk metamod *}{else}<META NAME="Keywords" CONTENT="{$config.Company.meta_keywords}">{* end of funkydunk metamod *}{/if}
{* funkydunk metamod 2003 *}
<META NAME="title" CONTENT="{$config.Company.meta_title}">
{* end of funkydunk metamod*}
<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="noarchive">
<META NAME="audience" CONTENT="all">
<META NAME="revisit-after" CONTENT="7 days">
<META NAME="Content-Language" CONTENT="en-us,english">
<META NAME="distribution" CONTENT="global">
{if $smarty.session.editor_mode eq "editor"}
<script>var store_language = "{$actual_languge}"</script>
{if $user_agent eq "ns"}
<script src="/store/skin1/editorns.js"></script>
{else}
<script src="/store/skin1/editor.js"></script>
{/if}
{/if}

Now when you go in to edit a category, you will have Page Title, Meta Description and Meta Keywords available. ALSO, the meta keywords WON'T just be added to the regular meta keywords that are specified in the old meta.tpl.

Enjoy!
Cameron

shan 05-26-2003 01:00 PM

:D

Cameron 05-26-2003 01:08 PM

I forgot to mention that under your company options you can specify general meta tags / title tag for the non category pages.

DogByteMan 05-29-2003 10:32 AM

Does the Meta Tags for the category tranfer to the product pages???

Is there a way to change a product page's meta tags other than change them every time you create an HTML catalog?

Thanks,
Greg

Cameron 05-29-2003 10:35 AM

Actually, no. The products pull their meta info from the tags you set under the "company options"

DogByteMan 05-29-2003 10:37 AM

That is extremely bad news.... Bummer

travisc 06-04-2003 12:21 AM

are meta tags really that important?
 
Seems like less and less importance is placed on the meta tag now days. Most engines seem to use the first paragraph or text on your index page. Can someone tell me the benefit of using this mod, beyond the obvious of having nice metas.

eleven 06-05-2003 07:51 AM

the title is important though
 
Yes, metatags aren't very important, BUT page titles are very important. If you use the HTML Catalog feature, this mod is great.

nerd luv 07-06-2003 07:30 PM

Just added this to my site and I'm very pleased with it! Hopefully there will be a way to incoprorate this with the product pages as well. Thank you funkydunk!

stryker898 07-06-2003 09:16 PM

The question is does this mod work with 3.4.2-3? Also, I just want to make sure its worth it. Right now each page has the same Title and Meta with the description of the product way down on the page. :roll: Not good from what I have seen so far.
Will this mod make it so the each product page (when converted to HTML catalog) will have a unique Meta and Title?

Chris

avi 07-13-2003 05:16 AM

Does it of a must to use HTML CATALOG
 
Friends

When using this - Should it be require to use HTML CATALOG
Also, It is hard to understand how it will work, Does the HTML function amend the html pages when changes are made. Or does it will be require to do all from square one. The manual is very unclear with regard to this all.


Thanks

adpboss 07-13-2003 06:36 AM

You should be using the html catalogue if you are concerned about better search engine positioning. The php based store does not index as well as pure html.

I always drop my existing catalog when i generate a new one. I don't see any advantage to keeping the existing pages. **EDIT** Never drop your catalogue if possible. Some of those pages may be indexed and you will lose valuable traffic to 404 errors.

jgkiefer 07-27-2003 08:34 AM

Does this Meta Mod work with 3.4????

jfinn98 08-14-2003 05:44 PM

Funkydunk, any reason why my title is sticking to the page
 
Funkydunk, thanks for offering the mods.

I had no problems inserting the codes and seeing what it does.
However when making category modifications I am seeing one there.

when I add title metas etc. then hit update, everything disapears. seems like it will not take the update.


next is:

when I go into company options and make changes to comapny title, meta keywords. Seems like this does update.

however, when I create my catalog (dump the old) and take a url to my browser I am only seeing the category name show up in the TITLE.

this is one of the most important things so I hope there is a simple way to fix or perhaps a small detail I have missed.

my cart version is:

X-Cart version 3.4.3
PHP 4.2.2




Thanks a lot man!

John Finney

rodneyw 08-16-2003 03:50 PM

Thanks as well for the mod.

I'm running 3.4.4 and it seems to be running fine. not sure if this deals with the mod or not but only thing I have ran into though is when viewing the Cart the page comes across as <title>#NAME?</title>

And on the checkout pages the title comes across empty.

Cameron 08-17-2003 10:41 AM

Jfinn, be sure that the MySQL patch was successful. It sounds like what you're having happen could be caused by missing information SQL info for the mod.

Rodneyw, here is some modified code for the title tag:
Quote:

{elseif $main eq "order_message"}
{$lng.txt_subtitle_thankyou}
{elseif $main eq "pictures"}
{$lng.txt_pictures}
{else}
{$lng.txt_site_title}
{/if}


The 'pictures' is in there because of an extra page that I added to the cart and I wanted a unique title for it. That can be applied to any extra pages you add to your xcart site.

Cameron

rodneyw 08-18-2003 05:09 AM

well I found my issue, it was in the language library.

The following entries had #NAME? listed as the value ..

{$lng.txt_subtitle_cart}

{$lng.txt_subtitle_checkout}

{$lng.txt_subtitle_thankyou}

Out of curiosty does anyone have an idea why this happened or is it a default setting that needs to be changed on initial installation??

rodneyw 08-24-2003 05:07 PM

Just as a FYI the modifications to the Mets.tpl file will break the webmaster mode in x-cart 3.4.4

Here is the "patched" version of the meta.tpl file that I am using with this to make it work.

Code:

{* $Id: meta.tpl,v 1.9 2002/11/19 14:53:27 ndv Exp $ *}
{* funkydunk metamod *}{if $current_category.meta_description ne ""}<META NAME="description" CONTENT="{$current_category.meta_description}">{else}<META NAME="description" CONTENT="{$config.Company.meta_description}">{/if}{* end of funkydunk metamod *}
{if $current_category.meta_tags ne ""}
<META NAME="keywords" content="{$current_category.meta_tags}">
{* funkydunk metamod *}{else}<META NAME="Keywords" CONTENT="{$config.Company.meta_keywords}">{* end of funkydunk metamod *}{/if}
{* funkydunk metamod 2003 *}
<META NAME="title" CONTENT="{$config.Company.meta_title}">
{* end of funkydunk metamod*}
<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="noarchive">
<META NAME="audience" CONTENT="all">
<META NAME="revisit-after" CONTENT="7 days">
<META NAME="Content-Language" CONTENT="en-us,english">
<META NAME="distribution" CONTENT="global">
{if $webmaster_mode eq "editor"}
{if ($usertype eq "P" or $usertype eq "A") and $login}
<script>var store_language = "{$current_language}"</script>
{else}
<script>var store_language = "{$store_language}"</script>
{/if}
{if $user_agent eq "ns"}
<script src="{$SkinDir}/editorns.js"></script>
{else}
<script src="{$SkinDir}/editor.js"></script>
{/if}
{/if}


dealsondeals 09-11-2003 07:03 PM

:D Great Mod!

8O Shouldn't this be moved to the "Custom Templates" section of the forum?

Regards,

Glen

jtheuman 09-12-2003 07:31 AM

Database patch
 
Could you help me here a bit. I am not sure just how to patch the database. Could be that all of this is new to me! Please help this old FORTRAN programmer!

funkydunk 09-12-2003 08:02 AM

In admin - patch/upgrade copy the sql query into the sql query box and press submit.

jtheuman 09-12-2003 09:57 AM

Database patch
 
Thanks Funkydunk! That was pretty painless even for me. Now, is there anything else I need to do to get this new code to work? Do I have to rebuild the catalog?

I am having a hard time following the code from php to where it does something on the page. Here again, all of my programming has been in traditional (1980's!) languages. This notion of style sheets is causing me to stay up late at night!

Again, thanks for your help to this old dog trying to learn new tricks...

chyldofsun 09-18-2003 10:40 PM

Re: Funkydunk's COOL mod for total meta tag control
 
Hi the only part i dont understand is how to First, patch my SQL database. Can you tell me how to do this exactly?

Thanks,
Ern


Quote:

Originally Posted by Cameron
I had Funkydunk do an x-cart customization for my 3.3.5 stores so that I could have total control over the title and meta tags for each category to score higher in the search engines. It works perfectly, and I want to share it with the rest of you. I have no idea if this works in 3.4.0, but it's fine in 3.3.5...3.3.6 will probably work fine too.

First, patch your SQL database with this info:
Quote:

INSERT INTO xcart_config VALUES ('meta_title', 'Meta Title', '', 'Company', 600, 'text');
INSERT INTO xcart_config VALUES ('meta_description', 'Meta Description', 'Offering Dolphin Jewelry, Dolphin Gifts, Dolphin Art, Dolphin Toys,Dolphin Animals and other Dolphin related products.', 'Company', 601, 'text');
INSERT INTO xcart_config VALUES ('meta_keywords', 'Meta Keywords', 'dolphins,dolphin jewelry,dolphin gifts,dolphin art,dolphin toys,dolphin tattoos,dolphin figurine,dolphin home decor,dolphin water fountains,dolphin clothing,dolphin books,dolphin videos,dolphin tote bags', 'Company', 602, 'text');

ALTER TABLE `xcart_categories` ADD `page_title` VARCHAR( 255 ) AFTER `description` ;
ALTER TABLE `xcart_categories` ADD `meta_description` VARCHAR( 255 ) AFTER `page_title` ;


Then replace the <title> tag of your home.tpl with this line, making sure you replace the COMPANYNAME.COM with whatever you want to show after your *product descriptions*
Quote:

<title>{if $main eq "catalog"}{if $location eq ""}{$config.Company.meta_title}{else}{* funkydunk metamod 2003 *}{if $current_category.page_title eq ""}{strip}{section name=position loop=$location start=0 }{if %position.last% eq "true"}{$location[position].0|escape}{/if}{/section}{/strip}{else}{$current_category.page_title}{/if}{* end of metamod *}{/if}{elseif $main eq "product"}{*{$current_category.page_title}:*}{ if $product.product ne ''}{$product.product} - COMPANYNAME.COM{/if}{elseif $main eq "help"}{$lng.txt_subtitle_help}{elseif $main eq "cart"}{$lng.txt_subtitle_cart}{elseif $main eq "checkout"}{$lng.txt_subtitle_checkout}{elseif $main eq "order_message"}{$lng.txt_subtitle_thankyou}{/if}</title>

Next, replace your skin1/admin/main/category_modify.tpl file with this one:
Quote:

{* $Id: category_modify.tpl,v 1.20 2002/11/10 09:26:46 ndv Exp $ *}
{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}[/img]</td>
<td colspan=2></td>
</tr>
<tr>
<td height="10" class=FormButton nowrap>Icon</td>
<td width="10" height="10"></td>
<td><input type="file" name="userfile"></td>
</tr>
<TR>
<TD height="10" class=FormButton nowrap>Orderб═by</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"}{e lseif $smarty.get.mode ne "add"}{$current_category.category|escape:"htmlall" }{/if}">
{if $category_error ne ""}
<font color=red><< 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"}{els eif $smarty.get.mode ne "add"}{$current_category.description|escape:"htmla ll"}{/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"}{else if $smarty.get.mode ne "add"}{$current_category.page_title|escape:"htmlal l"}{/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"}{elsei f $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%"}


Then replace your (store)/admin/category_modify.php file with this:
Quote:

<?
/************************************************** ***************************\
+-----------------------------------------------------------------------------+
| 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";

#
# 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") {

if (func_is_image_userfile($userfile, $userfile_size, $userfile_type)) {
move_uploaded_file($userfile, "$file_temp_dir/$userfile_name");
$userfile = "$file_temp_dir/$userfile_name";

list($image_size, $image_x, $image_y) = func_get_image_size($userfile);

$fd = fopen($userfile, "rb");
$image = addslashes(fread($fd, $image_size));
fclose($fd);

unlink($userfile);
}

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[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 (!func_is_image_userfile($userfile, $userfile_size, $userfile_type)) {
$image = $category_data["image"];
$image_x = $category_data["image_x"];
$image_y = $category_data["image_y"];
$userfile_type = $category_data["image_type"];
$image = addslashes($image);
}
}
#
# 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();

db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$parent_category/$category_name/%'");

db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image', '$userfile_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();
db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_name/%'");
db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image', '$userfile_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, '$old_category_name', '$category_name') where category like '$old_category_name/%'");
}

#
# Insert category icon
#
if (func_is_image_userfile($userfile, $userfile_size, $userfile_type))
db_query("update $sql_tbl[icons] set image='$image', image_type='$userfile_type' where categoryid='$cat'");

header("Location: category_modify.php?cat=$cat");
exit;
}

require "../include/categories.php";

require "./location_ajust.php";

$smarty->assign("usertype",$usertype);
$smarty->assign("rand", rand());
$smarty->assign("main","category_modify");
$smarty->assign("location",$location);

@include "../modules/gold_display.php";
$smarty->display("admin/home.tpl");
?>


Finally, this can replace your meta.tpl file (be warned, I have the editorns.js script called from the root directory instead of the default path meta.tpl comes with. If your store isn't in a directory called (store) then you will want to leave those lines out:
Quote:

{* $Id: meta.tpl,v 1.9 2002/11/19 14:53:27 ndv Exp $ *}
{* funkydunk metamod *}{if $current_category.meta_description ne ""}<META NAME="description" CONTENT="{$current_category.meta_description}">{el se}<META NAME="description" CONTENT="{$config.Company.meta_description}">{/if}{* end of funkydunk metamod *}
{if $current_category.meta_tags ne ""}
<META NAME="keywords" content="{$current_category.meta_tags}">
{* funkydunk metamod *}{else}<META NAME="Keywords" CONTENT="{$config.Company.meta_keywords}">{* end of funkydunk metamod *}{/if}
{* funkydunk metamod 2003 *}
<META NAME="title" CONTENT="{$config.Company.meta_title}">
{* end of funkydunk metamod*}
<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="noarchive">
<META NAME="audience" CONTENT="all">
<META NAME="revisit-after" CONTENT="7 days">
<META NAME="Content-Language" CONTENT="en-us,english">
<META NAME="distribution" CONTENT="global">
{if $smarty.session.editor_mode eq "editor"}
<script>var store_language = "{$actual_languge}"</script>
{if $user_agent eq "ns"}
<script src="/store/skin1/editorns.js"></script>
{else}
<script src="/store/skin1/editor.js"></script>
{/if}
{/if}

Now when you go in to edit a category, you will have Page Title, Meta Description and Meta Keywords available. ALSO, the meta keywords WON'T just be added to the regular meta keywords that are specified in the old meta.tpl.

Enjoy!
Cameron


funkydunk 09-18-2003 10:44 PM

copy the patch and paste it into the sql query box in admin-> patch/upgrade then press enter.

:D

DogByteMan 09-20-2003 04:59 PM

This one is a life saver!

Thanks FunkyDunk!

funkydunk 09-22-2003 11:11 AM

Quote:

Originally Posted by DogByteMan
Does the Meta Tags for the category tranfer to the product pages???

Is there a way to change a product page's meta tags other than change them every time you create an HTML catalog?

Thanks,
Greg

change the bit in the home.tpl to:

Code:

<title>
{if $main eq "catalog"}
{if $location eq ""}{$config.Company.meta_title}
{else}{* funkydunk metamod 2003 *}
        {if $current_category.page_title eq ""}
        {$config.Company.meta_title}
        {else}
        {$current_category.page_title}
        {/if}
{* end of metamod *}{/if}
{elseif $main eq "product"}{if $product.product ne ''}{$product.product} - {if $current_category.page_title eq ""}
        {$config.Company.meta_title}
        {else}
        {$current_category.page_title}
        {/if}{/if}
{elseif $main eq "help"}{$config.Company.meta_title}{$lng.txt_subtitle_help}
{elseif $main eq "cart"}{$config.Company.meta_title}{$lng.txt_subtitle_cart}
{elseif $main eq "checkout"}{$config.Company.meta_title}{$lng.txt_subtitle_checkout}
{elseif $main eq "order_message"}{$config.Company.meta_title}{$lng.txt_subtitle_thankyou}{/if}
</title>


eleven 09-26-2003 11:15 AM

minor problem using it in 3.4.4
 
i used this mod a few months ago with an earlier version (which i don't remember). I upgraded xcart to 3.4.4. Now a line break is placed at the beginning of the description. It adds a new break every time I hit submit. I can't seem to be able to figure out where it is being inserted.

Did anyone else have this problem?

http://designeleven.com/screenshot.gif

DogByteMan 09-26-2003 05:06 PM

I get it too but I have just been removing them each time I update the dialog. Maybe funkydunk will figure it out. But even if he does not, It's a small price to pay for the benifit received.

eleven 09-26-2003 07:30 PM

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.

funkydunk 09-26-2003 11:22 PM

Thanks for that :)

Here is the updated code into a 3.4.7 script:

Code:

<?
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart                                                                      |
| Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru>                      |
| All rights reserved.                                                        |
+-----------------------------------------------------------------------------+
| PLEASE READ  THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE  |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php                    |
|                                                                            |
| THIS  AGREEMENT  EXPRESSES  THE  TERMS  AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE  PROGRAM  AND  ASSOCIATED  DOCUMENTATION  THAT  RUSLAN  R. |
| FAZLIEV (hereinafter  referred to as "THE AUTHOR") IS FURNISHING  OR MAKING |
| AVAILABLE TO YOU WITH  THIS  AGREEMENT  (COLLECTIVELY,  THE  "SOFTWARE").  |
| PLEASE  REVIEW  THE  TERMS  AND  CONDITIONS  OF  THIS  LICENSE AGREEMENT |
| CAREFULLY  BEFORE  INSTALLING  OR  USING  THE  SOFTWARE.  BY INSTALLING, |
| COPYING  OR  OTHERWISE  USING  THE  SOFTWARE,  YOU  AND  YOUR  COMPANY |
| (COLLECTIVELY,  "YOU")  ARE  ACCEPTING  AND AGREEING  TO  THE TERMS OF THIS |
| LICENSE  AGREEMENT.  IF  YOU    ARE  NOT  WILLING  TO  BE  BOUND BY THIS |
| AGREEMENT, DO  NOT INSTALL OR USE THE SOFTWARE.  VARIOUS  COPYRIGHTS  AND |
| OTHER  INTELLECTUAL  PROPERTY  RIGHTS    PROTECT  THE  SOFTWARE.  THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES  YOU  LIMITED  RIGHTS  TO  USE |
| THE  SOFTWARE  AND  NOT  AN  AGREEMENT  FOR SALE OR FOR  TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT.      |
|                                                                            |
| The Initial Developer of the Original Code is Ruslan R. Fazliev            |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003          |
| Ruslan R. Fazliev. All Rights Reserved.                                    |
+-----------------------------------------------------------------------------+
\*****************************************************************************/

#
# $Id: category_modify.php,v 1.47.2.5 2003/09/04 13:30:06 mclap 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");
        $redirect_to_modify = true;
               
        if ($mode == "add" && !substr_count($category_name,"/")) {
#
# Get id, name and icon of parent category
#
                if( !empty($cat) ) {
                        $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) {
                                $category_name = $category_data["category"]."/".$category_name;

                                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
#
                $catcnt = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[categories] WHERE category='$category_name'"));

                if ($catcnt > 0) {
                        $smarty->assign("category_error", "2");
                        $redirect_to_modify = false;
                }
                else {
                        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')");
                        // db_query("insert into $sql_tbl[categories] (category, description, meta_tags, avail, order_by, membership) values ('$category_name', '$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("insert into $sql_tbl[categories] (category, description, meta_tags, avail, order_by, membership) values ('$category_path', '$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 category='$category_name', description='$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) {
                $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'");
        }


        if( $redirect_to_modify )
                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");
?>


daveb1 10-02-2003 10:57 AM

Hi Funkydunk,

I've read through this entire thread, and the mod looks fantastic. However, I'm not a programmer, and there seem to be several iterations of the same file, and some posters have only added updates for specific builds... so I'm now a bit confused :) I'm running 3.4.7. The updated code you've posted above... is this the only file I need to change (I'm assuming it's a change to category_modify.php), or do I still need to change the sql database and all the other things mentioned further up the thread? If that's the case, can you please give me a list of what actually needs changing, or even better, the actual code for each file appropriate for version 3.4.7.

Thanks a lot :D

Dave

funkydunk 10-02-2003 12:55 PM

follow it from the top of the thread - all the original code works fine.

The last bit is just to change the display of it in home.tpl.

jfinn98 10-11-2003 03:55 PM

3.48 worked great as far as I can tell.
 
Funky, Cameron and anyone else who has contributed.
Thanks!

I used the same mods all the way thru and seems that it worked well on 3.4.8. Haven't started to enter data yet but the correct fileds are in place.


One that that I struggled with at first was the concept of cutting and pasting the mysql statement. I use PHPmyadmin and this method gave me errors each time.

Not that anyone needs to use myadmin, but if you do just simply cut and paste one line at a time and build your columns this way. Use this method if you are getting errors like myself.


The suggested way would be the reccommended insert into the update patch section within the cart itself. I didn't see this at first but the info is definately in the threads.

Thanks again,

mydivascloset 10-19-2003 10:11 AM

Re: Funkydunk's COOL mod for total meta tag control
 
Quote:

Originally Posted by Cameron
First, patch your SQL database with this info:
Quote:

INSERT INTO xcart_config VALUES ('meta_title', 'Meta Title', '', 'Company', 600, 'text');
INSERT INTO xcart_config VALUES ('meta_description', 'Meta Description', 'Offering Dolphin Jewelry, Dolphin Gifts, Dolphin Art, Dolphin Toys,Dolphin Animals and other Dolphin related products.', 'Company', 601, 'text');
INSERT INTO xcart_config VALUES ('meta_keywords', 'Meta Keywords', 'dolphins,dolphin jewelry,dolphin gifts,dolphin art,dolphin toys,dolphin tattoos,dolphin figurine,dolphin home decor,dolphin water fountains,dolphin clothing,dolphin books,dolphin videos,dolphin tote bags', 'Company', 602, 'text');

ALTER TABLE `xcart_categories` ADD `page_title` VARCHAR( 255 ) AFTER `description` ;
ALTER TABLE `xcart_categories` ADD `meta_description` VARCHAR( 255 ) AFTER `page_title` ;

Cameron


I implemented the above code and didn't realize that I had to change the values, so now I have dolphin keywords and descriptions on pages that I don't modify.

How do I fix this?

mydivascloset 10-19-2003 10:19 AM

Re: Funkydunk's COOL mod for total meta tag control
 
Quote:

Originally Posted by mydivascloset
Quote:

Originally Posted by Cameron
First, patch your SQL database with this info:
Quote:

INSERT INTO xcart_config VALUES ('meta_title', 'Meta Title', '', 'Company', 600, 'text');
INSERT INTO xcart_config VALUES ('meta_description', 'Meta Description', 'Offering Dolphin Jewelry, Dolphin Gifts, Dolphin Art, Dolphin Toys,Dolphin Animals and other Dolphin related products.', 'Company', 601, 'text');
INSERT INTO xcart_config VALUES ('meta_keywords', 'Meta Keywords', 'dolphins,dolphin jewelry,dolphin gifts,dolphin art,dolphin toys,dolphin tattoos,dolphin figurine,dolphin home decor,dolphin water fountains,dolphin clothing,dolphin books,dolphin videos,dolphin tote bags', 'Company', 602, 'text');

ALTER TABLE `xcart_categories` ADD `page_title` VARCHAR( 255 ) AFTER `description` ;
ALTER TABLE `xcart_categories` ADD `meta_description` VARCHAR( 255 ) AFTER `page_title` ;

Cameron


I implemented the above code and didn't realize that I had to change the values, so now I have dolphin keywords and descriptions on pages that I don't modify.

How do I fix this?


Just figured it out. I can change the values in the "Company Option" section. :D

funkydunk 10-19-2003 12:03 PM

:lol:

longseason 10-25-2003 11:05 AM

Quote:

Originally Posted by funkydunk
Thanks for that :)

Here is the updated code into a 3.4.7 script:



I've followed the thread and modified everything but I'm getting parse errors on the category_modify.php. I think it has something to do with spaces in the code? I've checked the original x-cart 3.4.8 code and it's identical to the line the error is supposedly on. When I copy the line from the original and paste it in Funkydunk's 3.4.7 mod the error goes away. But the code is exactly the same just with a space or two! So far this has worked until one error that won't go away. Line 151 of funkydunk's code-

if ($category_path != $category_name && !func_query_first("select * from $sql_tbl[categories] where category='$category_path'")){


anyone know why i'm getting these errors? the admin/category_modify won't even load. If I restore it to the original, it works fine.

funkydunk 10-26-2003 12:24 AM

This is the code for 3.4.8

Code:

<?
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart                                                                      |
| Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru>                      |
| All rights reserved.                                                        |
+-----------------------------------------------------------------------------+
| PLEASE READ  THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE  |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php                    |
|                                                                            |
| THIS  AGREEMENT  EXPRESSES  THE  TERMS  AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE  PROGRAM  AND  ASSOCIATED  DOCUMENTATION  THAT  RUSLAN  R. |
| FAZLIEV (hereinafter  referred to as "THE AUTHOR") IS FURNISHING  OR MAKING |
| AVAILABLE TO YOU WITH  THIS  AGREEMENT  (COLLECTIVELY,  THE  "SOFTWARE").  |
| PLEASE  REVIEW  THE  TERMS  AND  CONDITIONS  OF  THIS  LICENSE AGREEMENT |
| CAREFULLY  BEFORE  INSTALLING  OR  USING  THE  SOFTWARE.  BY INSTALLING, |
| COPYING  OR  OTHERWISE  USING  THE  SOFTWARE,  YOU  AND  YOUR  COMPANY |
| (COLLECTIVELY,  "YOU")  ARE  ACCEPTING  AND AGREEING  TO  THE TERMS OF THIS |
| LICENSE  AGREEMENT.  IF  YOU    ARE  NOT  WILLING  TO  BE  BOUND BY THIS |
| AGREEMENT, DO  NOT INSTALL OR USE THE SOFTWARE.  VARIOUS  COPYRIGHTS  AND |
| OTHER  INTELLECTUAL  PROPERTY  RIGHTS    PROTECT  THE  SOFTWARE.  THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES  YOU  LIMITED  RIGHTS  TO  USE |
| THE  SOFTWARE  AND  NOT  AN  AGREEMENT  FOR SALE OR FOR  TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT.      |
|                                                                            |
| The Initial Developer of the Original Code is Ruslan R. Fazliev            |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003          |
| Ruslan R. Fazliev. All Rights Reserved.                                    |
+-----------------------------------------------------------------------------+
\*****************************************************************************/

#
# $Id: category_modify.php,v 1.47.2.5 2003/09/04 13:30:06 mclap 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");
        $redirect_to_modify = true;
               
        if ($mode == "add" && !substr_count($category_name,"/")) {
#
# Get id, name and icon of parent category
#
                if( !empty($cat) ) {
                        $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) {
                                $category_name = $category_data["category"]."/".$category_name;

                                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
#
                $catcnt = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[categories] WHERE category='$category_name'"));

                if ($catcnt > 0) {
                        $smarty->assign("category_error", "2");
                        $redirect_to_modify = false;
                }
                else {
                        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')");
                        // db_query("insert into $sql_tbl[categories] (category, description, meta_tags, avail, order_by, membership) values ('$category_name', '$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("insert into $sql_tbl[categories] (category, description, meta_tags, avail, order_by, membership) values ('$category_path', '$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 category='$category_name', description='$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) {
                $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'");
        }


        if( $redirect_to_modify )
                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");
?>


Dlee 10-26-2003 03:01 PM

Re: minor problem using it in 3.4.4
 
Quote:

Originally Posted by eleven
i used this mod a few months ago with an earlier version (which i don't remember). I upgraded xcart to 3.4.4. Now a line break is placed at the beginning of the description. It adds a new break every time I hit submit. I can't seem to be able to figure out where it is being inserted.

Did anyone else have this problem?

http://designeleven.com/screenshot.gif


I have upgraded to 3.4.8 and have applied the mod from the beginning of the thread. I don't think I have missed a step somewhere but I'm still having the line break issue at the top of the Description block.

Did this get fixed and I missed it somewhere or is it still an issue.

That little line break is annoying ....help! Please.

dlee

funkydunk 10-26-2003 10:10 PM

This must be because there is a return or new line in the category_modify.tpl around the description field.

Take the extra space around the value of that field out and it will stop doing this.

hth


All times are GMT -8. The time now is 10:08 AM.

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