X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Page Title in 4.2 (https://forum.x-cart.com/showthread.php?t=46663)

cflsystems 03-31-2009 11:53 AM

Page Title in 4.2
 
4.2 came out with some new features including meta keywords, meta descriptions and clean url's, but QT left out something very important - PAGE TITLE. Page title is still "product name-category name-store name" or "store name-category name-product name" and there is no setting to change that. I wonder why they didn't include page title for products, categories, static pages....
Anyway here is how this can be added. Please note that this is for stores that do not have 3rd party SEO addons and is for 4.2. Please make backups to your DB and store files first

1. Add new field to xcart_products table. I called my
product_page_title and is varchar(255), latin1_swedish_ci

2. Add new language variable - lbl_product_page_title with value "Product Page Title"

3. Open include/product_modify.php and find
Code:

$query_data = array(
and add to the array
Code:

"product_page_title" => $product_page_title

4. Open skin1/main/product_details.tpl and add
Code:

<tr>
 {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[product_page_title]" /></td>{/if}
 <td class="FormButton" nowrap="nowrap">{$lng.lbl_product_page_title}:</td>
 <td class="ProductDetails"><input type="text" name="product_page_title" class="InputWidth" value="{$product.product_page_title|escape:"html"}" /></td>
</tr>

when you want it to appear when adding/modifying product in admin. I would add it after [keywords]

5. Open include/import_products.php and find
Code:

$import_specification["PRODUCTS"] = array(
and add to the array
Code:

"product_page_title"=> array()

6. Open skin1/customer/service_head.tpl and find
Code:

{$html_page_title|escape}
and replace with
Code:

{if $product.product_page_title ne ""}
 {$product.product_page_title}
{else}
 {$html_page_title|escape}
{/if}


Same logic can be applied to the categories changing the coresponding files

alec.thomas 04-05-2009 10:17 AM

Re: Page Title in 4.2
 
this is very usefull, thank you for this post. I've been thinking about something like this for a while. It always looks good in serp's when your title does not get cut off half way on a word. I've changed it up a little though.

This line of code for skin1/main/product_details.tpl , i've added a maxchar limit to where google truncates the title tag:



Code:

<tr>


{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[product_page_title]" /></td>{/if}
<td class="FormButton" nowrap="nowrap">{$lng.lbl_product_page_title}:</td>
<td class="ProductDetails"><input type="text" name="product_page_title" maxlength="64" class="InputWidth" value="{$product.product_page_title|escape:"html"}" /></td>
</tr>





or what would be even better than this is a char counter on the text box that would show you how many characters you have left before Google truncation, but still allowed you to make a longer title tag.



cflsystems 04-05-2009 01:50 PM

Re: Page Title in 4.2
 
Yes Google picks up the first 64 characters but you can still show more in the title. That's the reason i left it without 64 character restriction. Glad someone got use of it though :)

presson83 04-29-2009 11:28 AM

Re: Page Title in 4.2
 
FANTASTIC mod clf! Thanks a TON for this.

Would you happen to know how to do this same thing for static pages / mind giving a quick tutorial on how to do it?

Thanks again!

cflsystems 04-29-2009 12:02 PM

Re: Page Title in 4.2
 
Happy it works out for you. I haven't done it for anything except product and category pages. The default x-cart way for right now works fine for my static pages so I didn't even look at the code and try to change it. I would say if you follow the same logic you will find the way. I might look at doing this a later time

cflsystems 05-01-2009 05:50 AM

Re: Page Title in 4.2
 
OK guys here it is. This mod is for stores that do not use any 3rd party SEO mods and was tested on 4.2.1. I am pretty sure it will work on 4.2 as well. Use it and/or modify it in any way you want to fit your needs, after all it is FREE, just please do not charge other people for it claiming is something you did :)

1. Backup your store and database first. Better yet try this mod on a test store and make sure it works before applying it to your live store.

2. Adding language variables. You can use myphpadmin or x-cart patch/upgrade section for this, or just add them manually in the language section
Code:


INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_category_page_title', 'Category Page Title', 'Labels');
INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_product_page_title', 'Product Page Title', 'Labels');
INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_manufacturer_page_title', 'Manufacturer Page Title', 'Labels');
INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_pages_page_title', 'Static Page Title', 'Labels');
INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_page_title_what_is', 'What is Page Title?', 'Labels');
INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'txt_page_title_descr', 'Every html document (page) must have a TITLE element in its head section. This title element should be used to identify the contents of the document and is one of the most important factors for SEO friendly web page. The title should be less then 64 characters in length and it should contain your primary keyword phrase for that page and any secondary keyword phrase that you may be targeting.', 'Text');


3. Adding new fields for category, product, manufacturer and static pages in the corresponding tables. You can use myphpadmin or x-cart patch/upgrade section for this.
Code:

ALTER TABLE `xcart_categories` ADD `category_page_title` varchar(255) Not Null
ALTER TABLE `xcart_products` ADD `product_page_title` varchar(255) Not Null
ALTER TABLE `xcart_manufacturers` ADD `manufacturer_page_title` varchar(255) Not Null
ALTER TABLE `xcart_pages` ADD `pages_page_title` varchar(255) Not Null


4. FOR CATEGORY PAGE TITLE
open admin/category_modify.php, find
Code:


$data = array(
"category" => $category_name,
"description" => $description,
"meta_description" => $meta_description,
"meta_keywords" => $meta_keywords,
"avail" => $avail,
"order_by" => $order_by,
"override_child_meta" => $override_child_meta
);

and replace with
Code:


$data = array(
"category" => $category_name,
"description" => $description,
"meta_description" => $meta_description,
"meta_keywords" => $meta_keywords,
"avail" => $avail,
"order_by" => $order_by,
"override_child_meta" => $override_child_meta,
"category_page_title" => $category_page_title #Added by CFL Systems for category page title
);


open skin1/admin/main/category_modufy.tpl, find
Code:

<tr>
<td height="10" class="FormButton" nowrap="nowrap">{$lng.lbl_category}:</td>
<td width="10" height="10"><font class="Star">*</font></td>
<td height="10">
<input type="text" name="category_name" id="category_name" maxlength="255" size="65" value="{if $category_error ne ""}{$smarty.post.category_name|escape:"html"}{elseif $mode ne "add"}{$current_category.category|escape:"html"}{/if}" {if $config.SEO.clean_urls_enabled eq "Y"}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if}/>
{if $category_error ne ""}
{if $category_error eq "2"}
<font color="red">&lt;&lt; {$lng.lbl_category_already_exists}</font>
{else}
<font color="red">&lt;&lt; {$lng.lbl_category_wrong_value}</font>
{/if}
{/if}
</td>
</tr>

and after it insert
Code:


{* Added by CFL Systems for category page title *}
<tr>
<td height="10" class="FormButton" nowrap="nowrap">{$lng.lbl_category_page_title}:</td>
<td width="10" height="10">&nbsp;</td>
<td height="10">
<input type="text" name="category_page_title" id="category_page_title" maxlength="64" size="100" value="{if $category_error ne ""}{$smarty.post.category_page_title|escape:"html"}{elseif $mode ne "add"}{$current_category.category_page_title|escape:"html"}{/if}" />
<a href="javascript:void(0);" class="NeedHelpLink" onmouseover="javascript: viewHelp('help_what_is_page_title', this);">{$lng.lbl_page_title_what_is}</a>
<div id="help_what_is_page_title" class="NeedHelpBox" style="display:none">{$lng.txt_page_title_descr}</div>
</td>
</tr>
{* Added by CFL Systems for category page title *}


open include/import_categories.php, find
Code:

define('IMPORT_CATEGORIES', 1);
$import_specification["CATEGORIES"] = array(

and add to the array
Code:

"category_page_title" => array() #Added by CFL Systems for category page title

in the same include/import_categories.php find
Code:


if (isset($category['product_count']))
$data['product_count'] = $category['product_count'];

and after it insert
Code:


if (isset($category['category_page_title']))
$data['category_page_title'] = $category['category_page_title']; #Added by CFL Systems for category page title


5. FOR PRODUCT PAGE TITLE
open include/product_modify.php and find
Code:


$query_data = array(
"product" => $product,
"keywords" => $keywords,

and add to the array
Code:


"product_page_title" => $product_page_title #Added by CFL Systems for product page title


open skin1/main/product_details.tpl, find
Code:


<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[product]" /></td>{/if}
<td class="FormButton" nowrap="nowrap">{$lng.lbl_product_name}* :</td>
<td class="ProductDetails">
<input type="text" name="product" id="product" size="45" class="InputWidth" value="{$product.product|escape}" {if $config.SEO.clean_urls_enabled eq "Y"}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if} />
{if $top_message.fillerror ne "" and $product.product eq ""}<font class="Star">&lt;&lt;</font>{/if}
</td>
</tr>

and after it insert
Code:


{* Added by CFL Systems for product page title *}
<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[product_page_title]" disabled="disabled" /></td>{/if}
<td class="FormButton" nowrap="nowrap">{$lng.lbl_product_page_title}:</td>
<td class="ProductDetails"><input type="text" name="product_page_title" maxlength="64" size="100" class="InputWidth" value="{$product.product_page_title|escape:"html"}" />
<a href="javascript:void(0);" class="NeedHelpLink" onmouseover="javascript: viewHelp('help_what_is_page_title', this);">{$lng.lbl_page_title_what_is}</a>
<div id="help_what_is_page_title" class="NeedHelpBox" style="display:none">{$lng.txt_page_title_descr}</div></td>
</tr>
{* Added by CFL Systems for product page title *}


open include/import_products.php and find
Code:


$import_specification["PRODUCTS"] = array(

and add to the array
Code:


"product_page_title" => array() # ADDED by CFL Systems for product page title


Continue in the next thread

cflsystems 05-01-2009 06:00 AM

Re: Page Title in 4.2
 
...... from the previous thread

6. FOR MANUFACTURER PAGE TITLE
open modules/Manufacturers/manufacturers.php and find
Code:


$query_data = array(
"url" => $url,
"descr" => $descr,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description
);

and replace with
Code:


$query_data = array(
"url" => $url,
"descr" => $descr,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description,
"manufacturer_page_title" => $manufacturer_page_title #Added by CFL Systems for manufacturer page title
);

in the same file find
Code:


$query_data = array(
"manufacturer" => $manufacturer,
"provider" => $login,
"descr" => $descr,
"url" => $url,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description
);

and replace with
Code:


$query_data = array(
"manufacturer" => $manufacturer,
"provider" => $login,
"descr" => $descr,
"url" => $url,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description,
"manufacturer_page_title" => manufacturer_page_title # Added by CFL Systems for manufacturer page title
);


open skin1/modules/Manufacturers/manufacturers.tpl, find
Code:


<tr>
<td width="20%" class="FormButton">{$lng.lbl_manufacturer}:</td>
<td><font class="Star">*</font></td>
<td width="80%"><input type="text" name="manufacturer" id="manufacturer" size="50" value="{$manufacturer.manufacturer|escape}" style="width:80%"{$disabled} {if $config.SEO.clean_urls_enabled eq "Y" && $administrate}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if} /></td>
</tr>

and after it insert
Code:


{* Added by CFL Systems for manufacturer page title *}
<tr>
<td width="20%" class="FormButton">{$lng.lbl_manufacturer_page_title}:</td>
<td>&nbsp;</td>
<td width="80%"><input type="text" name="manufacturer_page_title" id="manufacturer_page_title" maxlength="64" size="100" value="{$manufacturer.manufacturer_page_title|escape}" style="width:80%"{$disabled} />
<a href="javascript:void(0);" class="NeedHelpLink" onmouseover="javascript: viewHelp('help_what_is_page_title', this);">{$lng.lbl_page_title_what_is}</a>
<div id="help_what_is_page_title" class="NeedHelpBox" style="display:none">{$lng.txt_page_title_descr}</div></td>
</tr>
{* Added by CFL Systems for manufacturer page title *}


7. FOR STATIC PAGE TITLE
open admin/pages.php, find
Code:


$page_modified = array(
"pagetitle" => $pagetitle,
"pagecontent" => $pagecontent,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description,
"clean_url" => $clean_url
);

and replace with
Code:


$page_modified = array(
"pagetitle" => $pagetitle,
"pagecontent" => $pagecontent,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description,
"clean_url" => $clean_url,
"pages_page_title" => $pages_page_title # Added by CFL Systems for static page title
);

in the same file find
Code:


$query_data = array(
'filename' => $filename,
'title' => $pagetitle,
'level' => $level,
'orderby' => intval($orderby),
'active' => $active,
'language' => $current_language,
"show_in_menu" => $show_in_menu,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description
);

and replace with
Code:


$query_data = array(
'filename' => $filename,
'title' => $pagetitle,
'level' => $level,
'orderby' => intval($orderby),
'active' => $active,
'language' => $current_language,
"show_in_menu" => $show_in_menu,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description,
"pages_page_title" => $pages_page_title # Added by CFL Systems for static page title
);

in the same file find
Code:


$query_data = array(
'title' => $pagetitle,
'orderby' => intval($orderby),
'active' => $active,
"show_in_menu" => $show_in_menu,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description
);

and replace with
Code:


$query_data = array(
'title' => $pagetitle,
'orderby' => intval($orderby),
'active' => $active,
"show_in_menu" => $show_in_menu,
"meta_keywords" => $meta_keywords,
"meta_description" => $meta_description,
"pages_page_title" => $pages_page_title # Added by CFL Systems for static page title
);

in the same file find
Code:


$page_query = "SELECT pageid, filename, title, level, orderby, active, language, show_in_menu, meta_keywords, meta_description, $sql_tbl[clean_urls].clean_url, $sql_tbl[clean_urls].mtime FROM $sql_tbl[pages] LEFT JOIN $sql_tbl[clean_urls] ON $sql_tbl[clean_urls].resource_type = 'S' AND $sql_tbl[clean_urls].resource_id = '".@$clean_url_pageid."' ";

and replace with
Code:


$page_query = "SELECT pageid, filename, title, level, orderby, active, language, show_in_menu, meta_keywords, meta_description, pages_page_title, $sql_tbl[clean_urls].clean_url, $sql_tbl[clean_urls].mtime FROM $sql_tbl[pages] LEFT JOIN $sql_tbl[clean_urls] ON $sql_tbl[clean_urls].resource_type = 'S' AND $sql_tbl[clean_urls].resource_id = '".@$clean_url_pageid."' "; # Modified by CFL Systems for static page title

in the same file find
Code:


$smarty->assign("default_meta_description", $page_modified['meta_description']);

and after it insert
Code:


$smarty->assign("default_pages_page_title", $page_modifier['pages_page_title']); # Added by CFL Systems for static page title


open skin1/admin/main/page_edit.tpl, find
Code:


<tr>
<td height="10" class="FormButton" nowrap="nowrap" valign="top">{$lng.lbl_page_name}:</td>
<td><font class="Star">*</font></td>
<td><input type="text" name="pagetitle" value="{$page_data.title|default:"$default_page_title"}" size="45" {if $config.SEO.clean_urls_enabled eq "Y"}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if} /></td>
</tr>

and after it insert
Code:


{* Added by CFL Systems for static page title *}
<tr>
<td height="10" class="FormButton" nowrap="nowrap" valign="top">{$lng.lbl_pages_page_title}:</td>
<td>&nbsp;</td>
<td><input type="text" name="pages_page_title" maxlength="64" size="100" value="{$page_data.pages_page_title|default:"$default_pages_page_title"}" />
<a href="javascript:void(0);" class="NeedHelpLink" onmouseover="javascript: viewHelp('help_what_is_page_title', this);">{$lng.lbl_page_title_what_is}</a>
<div id="help_what_is_page_title" class="NeedHelpBox" style="display:none">{$lng.txt_page_title_descr}</div></td>
</tr>
{* Added by CFL Systems for static page title *}


Continue in the next thread

cflsystems 05-01-2009 06:01 AM

Re: Page Title in 4.2
 
...... from the previous thread

8. MAKE THE NEW TITLES APPEAR
open skin1/customer/service_head.tpl, find
Code:


<title>
..........................
</title>

and replace with
Code:


{* Added by CFL Systems for page titles *}
{if $main eq "catalog" && $current_category.category eq ""}
{assign var="temp_title" value="PUT HERE THE TITLE YOU WANT ON HOME PAGE"}
{elseif $main eq "catalog"}
{assign var="temp_title" value=$current_category.category_page_title}
{elseif $main eq "product"}
{assign var="temp_title" value=$product.product_page_title}
{elseif $main eq "pages"}
{assign var="temp_title" value=$page_data.pages_page_title}
{elseif $main eq "manufacturer_products"}
{assign var="temp_title" value=$manufacturer.manufacturer_page_title}
{else}
{assign var="temp_title" value=""}
{/if}
<title>
{if $temp_title ne ""}
{$temp_title|escape}
{else}
{$html_page_title|escape}
{/if}
</title>
{* Added by CFL Systems for page titles *}


9. Run cleanup.php

That's it. Hope it will work for you. It works for me. I tried to keep it clean and easy to follow. If you have trouble installing it I can do it for you. Enjoy!

HyPeR-X 05-31-2009 12:00 PM

Re: Page Title in 4.2
 
I am having some problems with the above modifications. I have followed all steps, but now when I want to edit a product it x-cart tells me to fill in all fields. But all are already filled in.

Can anyone tell me what I do wrong?

cflsystems 05-31-2009 12:35 PM

Re: Page Title in 4.2
 
What kind of errors?

HyPeR-X 05-31-2009 12:57 PM

Re: Page Title in 4.2
 
Quote:

Originally Posted by cflsystems
What kind of errors?


When editing product:

Quote:

Please make sure you have filled in properly all required fields!

When editing static page:

Quote:

Please fill in all the required fields.

I also noticed that when updating category it says its updated, but the page title doesn't show on customer pages nor when editing the category in admin panel.

cflsystems 05-31-2009 01:09 PM

Re: Page Title in 4.2
 
Non of this happens for me. Actually after your message I did all of this on my test site and got no errors. Everything works. Do you have any other modifications that might cause this? Are you sure you didn't make errors when making changes to php files?

HyPeR-X 05-31-2009 01:31 PM

Re: Page Title in 4.2
 
Quote:

Originally Posted by cflsystems
Non of this happens for me. Actually after your message I did all of this on my test site and got no errors. Everything works. Do you have any other modifications that might cause this? Are you sure you didn't make errors when making changes to php files?


I got it to work, instead of pasting it after:


<tr>
<td height="10" class="FormButton" nowrap="nowrap" valign="top">{$lng.lbl_page_name}:</td>
<td><font class="Star">*</font></td>
<td><input type="text" name="pagetitle" value="{$page_data.title|default:"$default_page_ti tle"}" size="45" {if $config.SEO.clean_urls_enabled eq "Y"}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if} /></td>
</tr>


I removed the above and pasted the new code, ofcourse x-cart cant read the names etc. then.

My fault, sorry! Thanks for the mod, works fine now :)

cflsystems 05-31-2009 02:05 PM

Re: Page Title in 4.2
 
Glad you got it working

Learner 08-21-2009 10:35 PM

Re: Page Title in 4.2
 
Anyone for 4.1.9. ?Any help !!!

Thanks to all.

cflsystems 08-22-2009 06:46 AM

Re: Page Title in 4.2
 
I am afraid you either have to pay someone to try fit this mod in 4.1.9 or go with commercial mod which will probably cost the same so...

ADDISON 08-23-2009 12:13 AM

Re: Page Title in 4.2
 
I am testing 4.3 beta and QT added some idea from you Steve. Good job anyway!

cflsystems 08-23-2009 05:56 AM

Re: Page Title in 4.2
 
I knew they will have to add this feature but to actually borrow this code wow means I am on the right track. Maybe xcart should have "credits" section in admin to put all names of ppl which code, ideas or beta testing they used :)

dwpers 09-04-2009 09:39 AM

Re: Page Title in 4.2
 
Here is another possible solution:

Passing variable title to header template

When the majority of your templates use the same headers and footers, it is common to split those out into their own templates and {include} them. But what if the header needs to have a different title, depending on what page you are coming from? You can pass the title to the header as an attribute when it is included.

Passing the title variable to the header template
mainpage.tpl - When the main page is drawn, the title of ⌠Main Page■ is passed to the header.tpl, and will subsequently be used as the title.

Code:

{include file='header.tpl' title='Main Page'}
{* template body goes here *}
{include file='footer.tpl'}


archives.tpl - When the archives page is drawn, the title will be ⌠Archives■. Notice in the archive example, we are using a variable from the archives_page.conf file instead of a hard coded variable.

Code:

{config_load file='archive_page.conf'}
{include file='header.tpl' title=#archivePageTitle#}
{* template body goes here *}
{include file='footer.tpl'}


header.tpl - Notice that ⌠Smarty News■ is printed if the $title variable is not set, using the default variable modifier.

Code:

<html>
<head>
<title>{$title|default:'Smarty News'}</title>
</head>
<body>
footer.tpl
</body>
</html>



This is all information that can be found in the Smarty docs.

digiemp 09-27-2009 06:41 PM

Re: Page Title in 4.2
 
I get the following error when trying to modify any category:

Parse error
: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/*edit*/public_html/*edit*.com/admin/category_modify.php on line 199

Here's what the file in question looks like, starting at line 189:

Code:

# Update general data of category
        #
        $data = array(
            "category" => $category_name,
            "description" => $description,
            "meta_description" => $meta_description,
            "meta_keywords" => $meta_keywords,
            "avail" => $avail,
            "order_by" => $order_by,
            "override_child_meta" => $override_child_meta
            "category_page_title" => $category_page_title
            );
        func_array2update("categories", $data, "categoryid = '$cat'");
        func_membership_update("category", $cat, $membershipids);

        if ($config['SEO']['clean_urls_enabled'] == 'N') {


Line 199 is the added
Code:

"category_page_title" => $category_page_title

Any suggestions?

cflsystems 09-27-2009 06:45 PM

Re: Page Title in 4.2
 
You have to have comma after each element of the array except for the last one. Put comma after
Code:

"override_child_meta" => $override_child_meta

digiemp 09-27-2009 06:51 PM

Re: Page Title in 4.2
 
Thanks!

Now I have to go back and add commas to the rest of the .php files =(
But at least I know what's wrong and how to fix it. I was afraid I'd have to go back and undo all the changes I just made.

Again, thanks, both for your addressing my question and also for this modification.

hooter 09-27-2009 07:40 PM

Re: Page Title in 4.2
 
Oops, sorry, never mind, I was responding to second page of thread not seeing it had already been answered on 3rd page.

digiemp 10-13-2009 08:22 AM

Re: Page Title in 4.2
 
Apparently I have messed up the import_categories.php file as well. I get the following error when trying to reach the import page:

Parse error
: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /public_html/*edit*.com/include/import_categories.php on line 78

Here is my code, hopefully I included enough of it for assistance.

Code:

if (!defined('IMPORT_CATEGORIES')) {
#
# Make default definitions (only on first inclusion!)
#
    define('IMPORT_CATEGORIES', 1);
    $import_specification["CATEGORIES"] = array(
        "category_page_title" => array() #Added by CFL Systems for category page title
        "script"        =>  "/include/import_categories.php",
        "tpls"              => array(
            "main/import_option_default_category.tpl",
            "main/import_option_category_path_sep.tpl",
            "main/import_option_images_directory.tpl"),
        "export_tpls"    => array(
            "main/export_option_export_images.tpl",
            "main/export_option_category_path_sep.tpl"),
        "permissions"    => "A", # Only admin can import categories
        "need_provider" => 0,
        "finalize"        => true,
        "export_sql"    => "SELECT categoryid FROM $sql_tbl[categories] ORDER BY categoryid_path, order_by",
        "orderby"        => 25,


Line 77, 78, and 79:

Code:

"category_page_title" => array() #Added by CFL Systems for category page title
        "script"        =>  "/include/import_categories.php",
        "tpls"              => array(


Thanks,

cflsystems 10-13-2009 09:53 AM

Re: Page Title in 4.2
 
You need comma (,) after "category_page_title" => array()

When I wrote that mod "category_page_title" => array() was the last call in the array. It look like for 4.2.2 they have added more elements into the array. Remember - array elements are separated by comma (,), no comma after the last one

digiemp 10-13-2009 10:36 AM

Re: Page Title in 4.2
 
Thank you. I have added a comma (see code below), but now get the same error for line 84. I guess I'm having trouble finding where to add/remove commas. I've added/removed them from a few different places now and each time gives me an error on a different line.

Code:

define('IMPORT_CATEGORIES', 1);
    $import_specification["CATEGORIES"] = array(
        "category_page_title" => array(), #Added by CFL Systems for category page title
        "script"        =>  "/include/import_categories.php",
        "tpls"              => array(
            "main/import_option_default_category.tpl",
            "main/import_option_category_path_sep.tpl",
            "main/import_option_images_directory.tpl"),
        "export_tpls"    => array(
            "main/export_option_export_images.tpl",
            "main/export_option_category_path_sep.tpl"),
        "permissions"    => "A", # Only admin can import categories
        "need_provider" => 0,
        "finalize"        => true,
        "export_sql"    => "SELECT categoryid FROM $sql_tbl[categories] ORDER BY categoryid_path, order_by",
        "orderby"        => 25,
        "depending"        => array("C","CI","CT"),
        "columns"        => array(
            "categoryid"  => array(
                "is_key"    => true,
                "type"        => "N",
                "required"    => false,
                "default"    => 0),
            "category"        => array(
                "is_key"    => true,
                "required"  => true),
            "clean_url"        => array(
                "type"    => "U"
            ),
            "descr"            => array(
                "eol_safe"    => true),
            "meta_keywords"    => array(),
            "meta_description"    => array(),
            "override_child_meta" => array(
                "type"        => "B",
                "default"    => "N"),
            "avail"            => array(
                "type"        => "B",
                "default"    => "Y"),
            "orderby"        => array(
                "type"        => "N",
                "default"    => 0),
            "views_stats"    => array(
                "type"        => "N"),
            "product_count"    => array(
                "type"        => "N"),
            "membershipid"    => array(
                "array"        => true,
                "type"        => "N"),
            "membership"    => array(
                "array"    => true),
            "icon"            => array(
                "type"        => "I",
                "itype"        => "C")
        )
    );


Line 83, 84, 85:
Code:

"export_tpls"    => array(
            "main/export_option_export_images.tpl",
            "main/export_option_category_path_sep.tpl"),


cflsystems 10-13-2009 10:57 AM

Re: Page Title in 4.2
 
I did not see this in when I answered before. It seems like my original instructions are not easy to follow, sorry. You are adding the code in the wrong place. It is not supposed to go right after
Code:

$import_specification["CATEGORIES"] = array(
Take it out of there and put it after
Code:

  "icon"  => array(
    "type"  => "I",
    "itype"  => "C")


so the code will look like this
Code:

.......................
  "membershipid" => array(
    "array"  => true,
    "type"  => "N"),
  "membership" => array(
    "array"    => true),
  "icon"  => array(
    "type"  => "I",
    "itype"  => "C"),
  "category_page_title" => array() #Added by CFL Systems for category page title
  )
 );


digiemp 10-13-2009 11:14 AM

Re: Page Title in 4.2
 
Still getting:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /public_html/*edit*.com/include/import_products.php on line 84

Code:
Code:

define('IMPORT_CATEGORIES', 1);
    $import_specification["CATEGORIES"] = array(
        "script"        =>  "/include/import_categories.php",
        "tpls"              => array(
            "main/import_option_default_category.tpl",
            "main/import_option_category_path_sep.tpl",
            "main/import_option_images_directory.tpl"),
        "export_tpls"    => array(
            "main/export_option_export_images.tpl",
(Line 84)     "main/export_option_category_path_sep.tpl"),
        "permissions"    => "A", # Only admin can import categories
        "need_provider" => 0,
.... ...

"membership"    => array(
                "array"    => true),
            "icon"            => array(
                "type"        => "I",
                "itype"        => "C"),
                "category_page_title" => array() #Added by CFL Systems for category page title
        )
    );


cflsystems 10-13-2009 11:58 AM

Re: Page Title in 4.2
 
Attach the entire import_categories.php file here. You may need to rename it to .txt or something else

digiemp 10-13-2009 12:08 PM

Re: Page Title in 4.2
 
1 Attachment(s)
Here it is. Thank you for looking into this.

cflsystems 10-13-2009 12:27 PM

Re: Page Title in 4.2
 
1 Attachment(s)
I couldn't see what's wrong - this is the stock xcart file with the line for the hack added. Try it

digiemp 10-13-2009 12:43 PM

Re: Page Title in 4.2
 
I uploaded your file and crossed my fingers; still getting an error on line 84.

digiemp 10-13-2009 12:59 PM

Re: Page Title in 4.2
 
What would it do if I took out the two bits of extra code, but left the additions in all of the other files?

cflsystems 10-13-2009 04:31 PM

Re: Page Title in 4.2
 
Restore the original file and see what happenes.

import_categories.php affects only the import/export process

digiemp 10-14-2009 07:17 PM

Re: Page Title in 4.2
 
Argh, I got it finally. I was seeing the same error, but if I bothered to actually read, the import_categories.php was fixed but the comma addition, however, the line 84 error was in the import_products.php file, which now has a comma added as well. Everything seems to be working thus far, at least I'm able to reach the desired page. Thanks for your help!

gatordp 10-22-2009 04:00 AM

Re: Page Title in 4.2
 
Just installed this mod and it works great!

dublniklz 11-03-2009 07:59 PM

Re: Page Title in 4.2
 
Did 4.2.3 fix this? I read the manual, but it isn't clear if there was a change made.

cflsystems 11-03-2009 08:12 PM

Re: Page Title in 4.2
 
No this is not present in 4.2.x
It will be in 4.3 as far as I know

mescalito_ve 12-14-2009 04:58 AM

Re: Page Title in 4.2
 
Thank you very much for this great mod!! It works great in 4.2.2

manishp 12-28-2009 07:49 PM

Re: Page Title in 4.2
 
I have installed this mod and it works great for Manufactures and Products.

For categories, I do see the new input box on the category modify page. When I hit update after adding a title, I get the message that the chages have been saved. But the category page title was reset to empty page field and nothing got saved.

I double checked all the changes and everything seems to be there.

Any ideas what I could be missing?


All times are GMT -8. The time now is 07:55 PM.

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