Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ULTIMATE Seo Urls 5 - by FWR Media


Recommended Posts

Hi, I am using Ultimate seo urls 5 r197 on oscommerce 2.2 and I'd like to add the Greek language, could you send me the greek character conversion file as well?

Thank you

Agis

Link to comment
Share on other sites

Hi,

Thank you very much for this contribution.

I installed it in a test folder on my site as I am trying to upgrade smoothly to OsCommerce 2.3.1.

I have English and Greek languages installed.

The contribution works perfectly with the english side of my site. When I switch to Greek it still shows only english urls. I have set enable multi language support to true and I have uploaded bm_languages file from the additional uploads folder. I added a greek.php file in character conversion folder.

Is there anything else I have to do?

Thank you in advance,

:)

 

 

Hi Alexandra, I'm using Ultimate seo urls 5 r197 on oscommerce 2.2 and I'm having the same problem here, though I haven't added a Greek character conversion file.

Did you find a solution on this?

Link to comment
Share on other sites

Hi Alexandra, I'm using Ultimate seo urls 5 r197 on oscommerce 2.2 and I'm having the same problem here, though I haven't added a Greek character conversion file.

Did you find a solution on this?

 

Assuming that English is the default language, you have a language set up in admin as "gr" ( code field of the languages table ) and that you have turned on multi language support then ..

 

www.mysite.com/index.php would load the English links and language.

 

www.mysite.com/index.php/gr would load Greek

Link to comment
Share on other sites

Assuming that English is the default language, you have a language set up in admin as "gr" ( code field of the languages table ) and that you have turned on multi language support then ..

 

www.mysite.com/index.php would load the English links and language.

 

www.mysite.com/index.php/gr would load Greek

 

hi Robert, thank you very much for your quick reply!

Indeed English is the default lanquage, and Greek is a secondary lanquage as "gr" ( code field of the languages table ), I also have multi language support turned on.

 

Yes you are correct

www.museumreplicas.gr/index.php is loading the English links and language and

www.museumreplicas.gr/index.php/gr is loading the Greek

 

Here are a couple of issues I have...

When I turn to Greek lanquage I can not add a product category in Greek with more than 16 characters (ex.: a propper translation for the product category "CYCLADIC COLLECTION" is "ΚΥΚΛΑΔΙΚΗ ΣΥΛΛΟΓΗ") but instead of "ΚΥΚΛΑΔΙΚΗ ΣΥΛΛΟΓΗ" it is translated to "ΚΥΚΛΑΔΙΚΗ ΣΥΛΛΟΓ�"

 

When I call the Greek product categories links I get this browser error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

 

Please advise

thanks

Agis

Link to comment
Share on other sites

Hi, I've just installed this mod and am getting

 

Fatal error: Cannot redeclare usu5_base_filename() (previously declared in /public_html/includes/application_top.php:52) in /public_html/includes/application_top.php on line 72

 

In application_top.php it says

 

 /**
 * ULTIMATE Seo Urls 5 PRO by FWR Media
 * function to return the base filename 
 */
 function usu5_base_filename() {
   // Probably won't get past SCRIPT_NAME unless this is reporting cgi location
   $base = new ArrayIterator( array( 'SCRIPT_NAME', 'PHP_SELF', 'REQUEST_URI', 'ORIG_PATH_INFO', 'HTTP_X_ORIGINAL_URL', 'HTTP_X_REWRITE_URL' ) );
   while ( $base->valid() ) {
     if ( array_key_exists(  $base->current(), $_SERVER ) && !empty(  $_SERVER[$base->current()] ) ) {
       if ( false !== strpos( $_SERVER[$base->current()], '.php' ) ) {
         preg_match( '@[a-z0-9_]+\.php@i', $_SERVER[$base->current()], $matches );
         if ( is_array( $matches ) && ( array_key_exists( 0, $matches ) )
                                   && ( substr( $matches[0], -4, 4 ) == '.php' )
                                   && ( is_readable( $matches[0] ) ) ) {
           return $matches[0];
         } 
       } 
     }
     $base->next();
   }
   // Some odd server set ups return / for SCRIPT_NAME and PHP_SELF when accessed as mysite.com (no index.php) where they usually return /index.php
   if ( ( $_SERVER['SCRIPT_NAME'] == '/' ) || ( $_SERVER['PHP_SELF'] == '/' ) ) {
     return 'index.php';
   }
   // Return the standard RC3 code 
   return ( ( ( strlen( ini_get( 'cgi.fix_pathinfo' ) ) > 0) && ( (bool)ini_get( 'cgi.fix_pathinfo' ) == false ) ) || !isset( $_SERVER['SCRIPT_NAME'] ) ) ? basename( $_SERVER['PHP_SELF'] ) : basename( $_SERVER['SCRIPT_NAME'] );
 } // End function
// set php_self in the local scope
 $PHP_SELF = usu5_base_filename();

 if ($request_type == 'NONSSL') {
   define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
 } else {
   define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
 }

 

Is this correct? And if so can you give me a clue on where to look for the error?

 

Thanks

Link to comment
Share on other sites

Hi, I've just installed this mod and am getting

 

Fatal error: Cannot redeclare usu5_base_filename() (previously declared in /public_html/includes/application_top.php:52) in /public_html/includes/application_top.php on line 72

 

 

Is this correct? And if so can you give me a clue on where to look for the error?

 

Thanks

 

To get rid of this error you just need to install it properly as per the instructions.

 

The error means that you have somehow added the usu5_base_filename() function twice.

Link to comment
Share on other sites

Robert,

 

I'm using the latest release of ULTIMATE Seo Urls 5 Pro and came across a known error. My google webmaster tools informed me that all my child categories had duplicate links.

 

Example:

/discount-ladies-golf-discount-ladies-golf-outerwear-c-105_108.html
/discount-ladies-golf-discount-ladies-golf-outerwear-c-108.html

I searched through this support topic and found you posted a fix for someone else who also had this issue. If this is a universal case I wanted to recommend the inclusion of your fix in the next release. Here is a link for others having this same problem Updated validator.php

 

- Ryan

Edited by 32 Degrees
Link to comment
Share on other sites

Robert,

 

I'm using the latest release of ULTIMATE Seo Urls 5 Pro and came across a known error. My google webmaster tools informed me that all my child categories had duplicate links.

 

Example:

/discount-ladies-golf-discount-ladies-golf-outerwear-c-105_108.html
/discount-ladies-golf-discount-ladies-golf-outerwear-c-108.html

 

- Ryan

 

Hi Ryan

 

Firstly please let me thank you for taking the time to read back through the support threads and finding the related topic rather than just posting your problem.

 

That particular file was to solve a localised redirect issue.

 

When you look at the two URIs

 

/discount-ladies-golf-discount-ladies-golf-outerwear-c-105_108.html

/discount-ladies-golf-discount-ladies-golf-outerwear-c-108.html

 

The problem is that they ARE duplicate content, two different URIs pointing to exactly the same page content.

 

This I currently view as a direct result of putting the same product in multiple categories.

 

If I have misunderstood the problem please let me know.

Link to comment
Share on other sites

hi

 

i got small issue..

i am using the latest version with only english language.

 

google has complained some of my url are non acessible.

 

they seem to have to the following characters in name

 

m²,®,®,£ etc

 

I have looked at the character_conversion_pack. i am not sure if that also applies to english language. in the config if i do .,..m²=>m2,®=>A,m²=>m2,®=>A,£=>p,then the page is accessible.

 

but for some reason if i add an other char then i get 404 error with the folloing in the url www.sitename.com/-p-36879.html .No product name.

 

I tried clearing cache but have no joy.

 

I found if removed the whole Enter special character conversions. block .. the site works.

 

Do i need to create a file for the english side aswell.I thought the contrib did this automatically.

 

kind regards

Link to comment
Share on other sites

Robert,

 

First of all ... Thank you for an absolute killer contribution! The best I have ever seen for OSC. Install very well documented and therefore simple.

 

All works fine, accept for the URL's for popup_image.php .... I read way back in the forum, tested with 2.2 and 2.3 (the last totally clean install) but I seem to miss the solution.

 

This is what I tried both in 2.2 and 2.3 - with cache and without cache:

 

echo '<a href="' . tep_href_link(FILENAME_POPUP_IMAGE,'pID=' . $product_info['products_id']) . '" >' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'.'<br><br>';

 

<script type="text/javascript"><!--

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

 

Hovering the links gives http://wwww.domain.com/popup_image.php?pID=16 ..... I suppose there is no need to add popup_image.php to /page_modules (allthough I tested this also) .. I looked over all the settings in debug-mode but no luck.

 

Any tips and help are appreciated!

 

Thank you,

 

Arjan

Link to comment
Share on other sites

Any tips and help are appreciated!

 

Thank you,

 

Arjan

Hmm .. it's a bit late and maybe I'm being "tired" but I don't believe the latest USU5 has a module for popup images ( as it is irrelevant )

Edited by FWR Media
Link to comment
Share on other sites

Hmm .. it's a bit late and maybe I'm being "tired" but I don't believe the latest USU5 has a module for popup images ( as it is irrelevant )

 

You are right! Late it is ... But I allready made some progress and indeed found out I need to make a popup_image.php in /page_modules ... I need it for backward compatibility with the old Chemo/Jack MCS url contribution because Google unfortunately indexed some popup_image.php for products ... It shouldn't offcourse but it did ... and I don't want to loose those links ... I will be redirecting them later on, but now visitors get a 404 page which I don't like anyway ...

 

Anyhow ... I am now a bit struggling with the $dependencies query ... I need them like this : www.domain.com/brand-model-productsname-pi-xxx.html ...

 

I started with this (and it works fine):

 

protected $dependencies = array( 'products_id' => array( 'marker' => '-pi-', // like -p- or -c- etc

'query' => "SELECT products_name FROM :TABLE_PRODUCTS_DESCRIPTION WHERE products_id=':products_id' AND language_id=':languages_id' LIMIT 1",

'to_replace' => array( ':TABLE_PRODUCTS_DESCRIPTION', ':products_id', ':languages_id' ) ) ); // TABLE_XXX and pID must match the line above

 

But now I need to put in the brand and model in the URL and an extra _GET key for image eg the url would be like:

www.domain.com/brand-model-productsname-pi-xxx.html?image=3

 

So if you could help me out (whenever you have some time) I would be thankful!

 

Arjan

Edited by azpro
Link to comment
Share on other sites

Ok ... I solved it and it's working great!

 

For those people who also want/need to keep using popup_image.php with SEO url .... altough I recommend to upgrade OSC2.3 ...

 

- Copy the code and save in folder /page_modules as popup_image.php

- The .htacces already has the line in it for rewriting the URL (if you have uri fromat rewrite in your admin settings) ... I only tested with rewrite!

- I changed the _GET key from pID to products_id in the javascript snippets:

 

<script type="text/javascript"><!--

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'products_id=' . $product_info['products_id'].'ℑ=1') . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

 

- It also works for additional images

 

class Popup_Image_Page_Module extends aPage_Modules {

 

private static $_singleton = null;

/**

* Array of _GET key dependencies for this page

* - marker is the seo url replacement for the dependent _GET key ( e.g. -c- replaces cPath )

* - query is the query used to extract the link text from the database

* - to_replace is an array of texts that are to be replace with real values in the query

* @example protected $dependencies = array( 'cPath' => array( 'marker' => '-c-',

* @var array $dependencies

*/

 

protected $dependencies = array( 'products_id' => array( 'marker' => '-pi-',

'query' => "SELECT pd.products_name, m.manufacturers_name, cd.categories_name, p.products_model, p2c.categories_id FROM :TABLE_PRODUCTS_DESCRIPTION pd INNER JOIN :TABLE_PRODUCTS_TO_CATEGORIES p2c ON p2c.products_id = pd.products_id INNER JOIN :TABLE_PRODUCTS p ON pd.products_id = p.products_id LEFT JOIN :TABLE_MANUFACTURERS m ON m.manufacturers_id = p.manufacturers_id INNER JOIN :TABLE_CATEGORIES_DESCRIPTION cd ON p2c.categories_id = cd.categories_id AND cd.language_id=':languages_id' WHERE pd.products_id=':products_id' AND pd.language_id=':languages_id' LIMIT 1",

'to_replace' => array( ':TABLE_PRODUCTS_DESCRIPTION', ':TABLE_PRODUCTS_TO_CATEGORIES', ':TABLE_PRODUCTS', ':TABLE_MANUFACTURERS', ':TABLE_CATEGORIES_DESCRIPTION', ':languages_id', ':products_id' ) ) );

 

 

/**

* The current dependency key extracted from the incoming parameters

*

* @var string $key - dependency key

*/

protected $key = null;

/**

* extracts the key => value pairs from the querystring in order to build a unique cache name for the loaded page

*

* @var array $cache_name_builder

*/

protected $cache_name_builder = array( 'products_id' => 1, 'image'=> 1 ); // xxx = _GET key ( e.g. cPath ), you may want to add "page" if there are paging functions

/**

* Class constructor

* @access private

*/

private function __construct() {

} // end constructor

/**

* Returns a singleton instance of this object

*

* @access public

* @return Article_Info_Page_Module

*/

public static function i() {

if ( !self::$_singleton instanceof self ) {

self::$_singleton = new self;

}

return self::$_singleton;

} // end method

/**

* Retrieve the dependencies array for this page module

*

* @access public

* @return array $dependencies

*/

public function retrieveDependencies() {

return $this->dependencies;

}

/**

* Acquire an array of single or multiple link texts from the query

* this will be cached for later retrieval.

*

* @see Usu_Main::query()

* @uses trim()

*

* @access protected

* @return array array of link test

*/

protected function acquireLinkText() {

$result = Usu_Main::i()->query( $this->query );

$text_array = tep_db_fetch_array( $result );

tep_db_free_result( $result );

if ( false === $text_array ) {

return false;

}

$final_text_array = array();

foreach ( $text_array as $key => $text ) {

if ( tep_not_null( trim( $text ) ) ) {

$final_text_array[$key] = $text;

}

}

// We will cache this result

return $final_text_array;

}

/**

* The main method of this class that receives input needed to build a link

* then finally returns a fully built seo link if it has not previousluy returned false.

*

* @see Usu_Main::getVar()

* @see Usu_Main::setVar()

* @see aPage_Modules::stripPathToLastNumber()

* @see aPage_Modules::setQuery()

* @see aPage_Modules::unsetProperties()

* @see aPage_Modules::getDependencyKey()

* @see aPage_Modules::setAllParams()

* @see aPage_Modules::validRequest()

* @see aPage_Modules::returnFinalLink()

* @param string $page - valid osCommerce page name

* @param string $parameters - querystring parameters

* @param bool $add_session_id - true / false

* @param string $connection - NONSSL / SSL

* @param array $extract - array of _GET keys to remove from the querystring or bool false to do nothing

* @uses trigger_error()

* @throws - triggers an error of type E_USER_WARNING for an incorrect or inexistant dependency key

* @access public

* @return bool false - forces the system to return the standard osCommerce link wrapper

* @return string - fully built seo url

*/

public function buildLink( $page, $parameters, $add_session_id, $connection ) {

$extract = array( 'products_id' ); // xxx = _GET key ( e.g. cPath )

$this->setAllParams( $page, $parameters, $add_session_id, $connection, $extract );

if ( false === $this->validRequest() ) {

$this->unsetProperties();

return false;

}

$this->key = $this->getDependencyKey();

/**

* If the shop has issues it may pass in null values, in this case return false to force the standard osCommerce link wrapper

*/

if ( !array_key_exists( $this->key, $this->keys_index ) || !tep_not_null( $this->keys_index[$this->key] ) ) {

return false;

}

// Switch statement where the correct query and query marker replacements to use are selected via the _GET key detected

switch ( true ) {

case $this->key == 'products_id': // xxx = _GET key ( e.g. cPath )

// This array contains replacements for the to_replace array ( see the $dependencies array )

$this->setQuery( array( TABLE_PRODUCTS_DESCRIPTION, TABLE_PRODUCTS_TO_CATEGORIES, TABLE_PRODUCTS, TABLE_MANUFACTURERS, TABLE_CATEGORIES_DESCRIPTION, Usu_Main::i()->getVar( 'languages_id' ), $this->keys_index[$this->key] ) );

break;

default:

trigger_error( __CLASS__ . '::' . __FUNCTION__ . ' Incorrect or inexistant dependency key.', E_USER_WARNING );

break;

} // end switch

$link_text = $this->acquireLinkText();

// If the query returned false then we return nothing and set $page_not_found to true forcing a 404 page

Usu_Main::i()->setVar( 'page_not_found', false );

if ( false === $link_text ) {

Usu_Main::i()->setVar( 'page_not_found', true );

$this->unsetProperties();

return;

}

// Return a fully built seo url

return $this->returnFinalLink( Usu_Main::i()

->getVar( 'uri_modules', USU5_URLS_TYPE )

->createLinkString( $this->page, Usu_Main::i()

->getVar( 'uri_modules', USU5_URLS_TYPE )

->separateUriText( $this->linktext( $this->linkTextOrder( $link_text ) ) ), $this->dependencies[$this->key]['marker'], $this->keys_index[$this->key] ) );

} // end method

/**

* Like text options offered by b,c,m,p

*

* Builds the link text based on the settings chosen in admin .. products name must be present or the script adds it regardless.

*

* @uses array_key_exists()

* @uses stripos()

* @uses str_split()

* @uses array_flip()

* @uses array_intersect_key()

* @uses count()

* @param array $details - link text key=>value pairs

*

* @access private

* @return array $to_seperate - array of link text options in the correct order

*/

private function linkTextOrder( array $details = array() ) {

$text_types = array( 'p' => $details['products_name'], 'c' => $details['categories_name'], 'm' => $details['products_model'] );

// manufacturers_name is gained through a left join and may not exist

array_key_exists( 'manufacturers_name', $details ) ? $text_types['b'] = $details['manufacturers_name'] : null;

// Products name MUST be present, if not we force it to the end

if ( false === stripos( USU5_PRODUCTS_LINK_TEXT_ORDER, 'p' ) ) {

$admin_order = str_split( USU5_PRODUCTS_LINK_TEXT_ORDER . 'p' );

} else $admin_order = str_split( USU5_PRODUCTS_LINK_TEXT_ORDER );

// Split the string value entered in admin ( like mcp etc ) to an array

$text_order = array_flip( $admin_order ); // Flip key => value to value => key

$text_to_format = array_intersect_key( $text_types, $text_order ); // return only those key => value pairs that match the admin selection

$link_text_count = count( $admin_order );

$ordered_array = array();

for ( $i=0; $i<$link_text_count; $i++ ) {

if ( ( array_key_exists( $admin_order[$i], $text_to_format ) && tep_not_null( $text_to_format[$admin_order[$i]] ) ) ) { // If a value is empty then we don't want to add it to the link text

$to_seperate[] = $text_to_format[$admin_order[$i]]; // Create an array where the link text is in the same order as the admin selection

}

}

return $to_seperate;

} // End method

 

} // end class

 

Maybe Robert can comment on possible pitfalls!

 

Test first and use at own risk!

 

 

Cheers!

Link to comment
Share on other sites

So I've followed the instructions, and repeated them to make sure I did everything right,

 

You need to check again as you haven't done everything right. The function tep_href_link() is missing from catalog/includes/functions/html_output.php

Link to comment
Share on other sites

You need to check again as you haven't done everything right. The function tep_href_link() is missing from catalog/includes/functions/html_output.php

 

You were right for some reason the code was there but it had all been moved onto one line, so it was commented out. Not sure why that happened but It's working now. It didn't look like that on my work PC when I had notepad++ but when I opened it on my home PC it was formatted that way :P

Link to comment
Share on other sites

@robert

thank you for your fantastic contrib and your great support

 

Any possibility/suggestion than to switch off USU5 on category URLs?

 

Anyway, thanks Robert. For both - contributions and being present in the support thread.

 

in the configuration of USU5 you have to set the value of "Force www.mysite.com/ when www.mysite.com/index.php" to false to get the YMM contrib working

Link to comment
Share on other sites

Robert,

 

Upgraded to your Pro version.

 

Am getting an odd issue with forcing cookies on. If you clear out cookies in a browser, everything is fine until your second click the site redirects you to the index page. Assuming its a session issue since once this happens if you keep the cookie there are no further issues. Wondering if this has happened to someone before? Tried in html_output

 

 function tep_href_link( $page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true ) {
   return Usu_Main::i()->hrefLink( $page, $parameters, $connection, $add_session_id, $search_engine_safe );
 }

 

 function tep_href_link( $page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = false, $search_engine_safe = true ) {
   return Usu_Main::i()->hrefLink( $page, $parameters, $connection, $add_session_id, $search_engine_safe );
 }

 

But still experiencing the issue. This is a long thread and haven't seen this issue, please if I could be pointed in the right direction.

 

Thanks

Link to comment
Share on other sites

Robert,

 

Upgraded to your Pro version.

 

Am getting an odd issue with forcing cookies on. If you clear out cookies in a browser, everything is fine until your second click the site redirects you to the index page. Assuming its a session issue since once this happens if you keep the cookie there are no further issues. Wondering if this has happened to someone before? Tried in html_output

 

But still experiencing the issue. This is a long thread and haven't seen this issue, please if I could be pointed in the right direction.

 

Thanks

 

You don't need to change USU5 files as there are no known issues currently.

 

I think you are looking in the wrong place for your problem.

 

There are only 3 situations where USU5 could affect a redirect. None of them are related to cookies.

 

1) Admin setting where www.mysite.com/index.php is redirected to www.mysite.com ( turn it off if on as this doesn't work on some servers ).

2) .htaccess RewriteRules - these are static so wouldn't create your problem.

3) Old seo urls redirecting to the new. Not related to cookies.

Link to comment
Share on other sites

Hi Robert,

 

Thanks for all your hard work on this amazing contribution.

 

I've been trying to get Sage Pay Server working and have come across your post that says w3c style urls will cause problems with the redirect url. I tested with w3c urls switched off and it worked fine.

 

Is there any chance that there is a workaround to this problem that I've missed? I'd rather not switch off w3c urls because they look more professional.

 

Keep up the great work.

 

Andy

Link to comment
Share on other sites

Robert,

 

I did some more reading and experiments with SEO URL 5 and wondered if you could comment...

 

Would there be any SEO benefits with category URLs like parent/category-c-1.html instead of category URLs like parent-category-c-1.html which SEO URL 5 pro outputs now?

 

Reading a lot about this issue, I couldn't really decide, but I figured especially for large shops the separator slash could be a benefit ...

 

If you agree ... could you give a hint to fix the rewrite URL to parent/sub/category instead of parent-sub-category ?

 

Tnx!

 

Arjan

Link to comment
Share on other sites

Hello,

 

It's possible to tell where is my error.

 

I created a new files blog_content.php (see an article) and create a new add on in pages_modules called blog_content.php

 

When I want to see my article, I have a page not found :

The requested URL /boutique/comportements-multicanaux-etudes-decouvrir-bl-26.html was not found on this server.

my original url :

http://www.mysite.com/boutique/blog_content.php?blog_content_id=26

Thanks.

 

 

 

 

Process :

 

I write in ht access this line :

RewriteRule ^([a-z0-9/-]+)-bl-([0-9]+).html$ blog_content.php [NC,L,QSA]

 

and I write this module :

 

 class Blog_Content_Page_Module extends aPage_Modules {
private static $_singleton = null;
/**
* Array of _GET key dependencies for this page
* - marker is the seo url replacement for the dependent _GET key ( e.g. -c- replaces cPath )
* - query is the query used to extract the link text from the database
* - to_replace is an array of texts that are to be replace with real values in the query
* @example protected $dependencies = array( 'cPath' => array( 'marker' 	=> '-c-',
* @var array $dependencies
*/
//                                                        	'query'  	=> "SELECT pd.blog_content_name FROM :TABLE_BLOG_CONTENT_DESCRIPTION pd INNER JOIN :TABLE_BLOG_CONTENT p ON pd.blog_content_id = p.blog_content_id WHERE pd.blog_content_id=':blog_content_id' AND pd.language_id=':languages_id' LIMIT 1",
protected $dependencies = array( 'blog_content_id' => array( 'marker' 	=> '-bl-',
                                                			'query'  	=> "SELECT pd.blog_content_name FROM :TABLE_BLOG_CONTENT_DESCRIPTION pd where pd.blog_content_id=':blog_content_id' AND pd.language_id=':languages_id' LIMIT 1",
                                                			'to_replace' => array( ':TABLE_BLOG_CONTENT_DESCRIPTION', ':TABLE_BLOG_CONTENT', ':blog_content_id', ':languages_id' ) ) );
/**
* The current dependency key extracted from the incoming parameters
*                                                   			
* @var string $key - dependency key
*/
protected $key = null;
/**
* extracts the key => value pairs from the querystring in order to build a unique cache name for the loaded page
*  
* @var array $cache_name_builder
*/
//	protected $cache_name_builder = array( 'blog_content_id' => 1, 'reviews_id' => 1 ); // xxx = _GET key ( e.g. cPath ), you may want to add "page" if there are paging functions
protected $cache_name_builder = array( 'blog_content_id' => 1); // xxx = _GET key ( e.g. cPath ), you may want to add "page" if there are paging functions

/**
* Class constructor
* @access private
*/
private function __construct() {
} // end constructor
/**
* Returns a singleton instance of this object
* 
* @access public
* @return Blog_Content_Page_Module
*/
public static function i() {
	if ( !self::$_singleton instanceof self ) {
  	self::$_singleton = new self;
	}
	return self::$_singleton; 
} // end method
/**
* Retrieve the dependencies array for this page module
* 
* @access public
* @return array $dependencies
*/
public function retrieveDependencies() {
 	return $this->dependencies;
}
/**
* Acquire an array of single or multiple link texts from the query
* this will be cached for later retrieval.
* 
* @see Usu_Main::query()
* @uses trim()
* 
* @access protected
* @return array array of link test 
*/
protected function acquireLinkText() {
 	$result = Usu_Main::i()->query( $this->query );
 	$text_array = tep_db_fetch_array( $result );
 	tep_db_free_result( $result );
 	if ( false === $text_array ) {
   	return false;
 	}
 	$final_text_array = array();
 	foreach ( $text_array as $key => $text ) {
   	if ( tep_not_null( trim( $text ) ) ) {
     	$final_text_array[$key] = $text;
   	}
 	}
 	// We will cache this result
 	return $final_text_array;
}
/**
* The main method of this class that receives input needed to build a link
* then finally returns a fully built seo link if it has not previousluy returned false.
* 
* @see Usu_Main::getVar()
* @see Usu_Main::setVar()
* @see aPage_Modules::stripPathToLastNumber()
* @see aPage_Modules::setQuery()
* @see aPage_Modules::unsetProperties()
* @see aPage_Modules::getDependencyKey()
* @see aPage_Modules::setAllParams()
* @see aPage_Modules::validRequest()
* @see aPage_Modules::returnFinalLink()
* @param string $page - valid osCommerce page name
* @param string $parameters - querystring parameters
* @param bool $add_session_id - true / false
* @param string $connection - NONSSL / SSL
* @param array $extract - array of _GET keys to remove from the querystring or bool false to do nothing
* @uses trigger_error()
* @throws - triggers an error of type E_USER_WARNING for an incorrect or inexistant dependency key
* @access public
* @return bool false - forces the system to return the standard osCommerce link wrapper
* @return string - fully built seo url
*/
public function buildLink( $page, $parameters, $add_session_id, $connection ) {
 	$extract = array( 'blog_content_id' );
 	$this->setAllParams( $page, $parameters, $add_session_id, $connection, $extract );
 	if ( false === $this->validRequest() ) {
   	$this->unsetProperties();
   	return false;
 	}
 	$this->key = $this->getDependencyKey();
 	/**
 	* If the shop has issues it may pass in null values, in this case return false to force the standard osCommerce link wrapper
 	*/
 	if ( !array_key_exists( $this->key, $this->keys_index ) || !tep_not_null( $this->keys_index[$this->key] ) ) {
   	return false;
 	}
 	// Switch statement where the correct query and query marker replacements to use are selected via the _GET key detected
 	switch ( true ) {
   	case $this->key == 'blog_content_id': // xxx = _GET key ( e.g. cPath )
     	// This array contains replacements for the to_replace array ( see the $dependencies array )
     	$this->setQuery( array( TABLE_BLOG_CONTENT_DESCRIPTION, TABLE_BLOG_CONTENT, $this->stripPathToLastNumber( $this->keys_index[$this->key] ), Usu_Main::i()->getVar( 'languages_id' ) ) );
     	break;
   	default:
     	trigger_error( __CLASS__ . '::' . __FUNCTION__ . ' Incorrect or inexistant dependency key.', E_USER_WARNING );
     	break;
 	} // end switch
 	$link_text = $this->acquireLinkText();
 	// If the query returned false then we return nothing and set $page_not_found to true forcing a 404 page
 	Usu_Main::i()->setVar( 'page_not_found', false );
 	if ( false === $link_text ) {
   	Usu_Main::i()->setVar( 'page_not_found', true );
   	$this->unsetProperties();
   	return;
 	}
 	// Return a fully built seo url
 	return $this->returnFinalLink( Usu_Main::i()
             	->getVar( 'uri_modules', USU5_URLS_TYPE )
             	->createLinkString( $this->page, Usu_Main::i()
             	->getVar( 'uri_modules', USU5_URLS_TYPE )
             	->separateUriText( $this->linktext( $link_text ) ), $this->dependencies[$this->key]['marker'], $this->keys_index[$this->key] ) );
} // end method

 } // end class

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Link to comment
Share on other sites

Hello,

 

It's possible to tell where is my error.

 

I created a new files blog_content.php (see an article) and create a new add on in pages_modules called blog_content.php

 

When I want to see my article, I have a page not found :

my original url :

http://www.mysite.com/boutique/blog_content.php?blog_content_id=26

Thanks.

 

 

Sorry, it works !!! :blush:


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Link to comment
Share on other sites

New Install on modified OSC 2.3.1

 

Came back with this error: Parse error: syntax error, unexpected ';' in *****/eastvalleyrc.com/index.php on line 286

 

Line 286 reads:

			<tr><td align="right" class="main">' . tep_draw_form('filter', tep_href_link( FILENAME_DEFAULT ), 'get' . '<b>'.TEXT_SHOW . '</b>  ';

 

The only issue I had with the install was found in application_top.php. It did not have the EXACT info you requested to find/replace. Instead it had:

 

// set php_self in the local scope
 if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

 if ($request_type == 'NONSSL') {
   define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
 } else {
   define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
 }

 

Everything else was a find/replace (or find/add as instructred) using dreamweaver. Donation incoming if we can get this ironed out soon! Love all your contributions so far.

Edited by ColeKelly
Link to comment
Share on other sites

Your code has a syntax error ( a missing ")" )

 

Try this:

 

<tr> <td align="right" class="main">' . tep_draw_form('filter', tep_href_link( FILENAME_DEFAULT ), 'get' ) . '<b>'.TEXT_SHOW . '</b>  ';

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...