Jump to content

Archived

This topic is now archived and is closed to further replies.

jomagalo

As restrict "View All"?

Recommended Posts

In my case much users use the link "View All". Due to the volume of products to display in the sql query, I would like retringir use this link to such registered users. Any idea how to do it?

 

Thank's

Share this post


Link to post
Share on other sites

In the file /classes/db/database.class.php, near line 411 (for CC5216), starts the function pagination(). One the arguments that could be passed into the function is $view_all which defaults to true. The true value means to display the link that has a URL that includes page=all. A false value means to not display the link.

 

You can try:

Near line 451:
Was:
  'view_all' => (bool)$view_all,
);
$GLOBALS['smarty']->assign($data);
return $GLOBALS['smarty']->fetch('templates/element.paginate.php');
 
Now:
  'view_all' => ( ($GLOBALS['user']->is()) ? (bool)$view_all : false ),
);
$GLOBALS['smarty']->assign($data);
return $GLOBALS['smarty']->fetch('templates/element.paginate.php');

What this change should do is test if a registered user is logged in. If so, honor whether or not to show the View All link. If not logged in, do not show the link.

 

Now, what happens when someone manually enters a link, or finds a link elsewhere from a search, that has the page=all in the URL? You will need to decide how strict you want CubeCart to behave in this instance.

Share this post


Link to post
Share on other sites

there is a problem with that modification. In frontend will perfect. But in backend blank page

Share this post


Link to post
Share on other sites

Of course, ($GLOBALS['user']->is()) the 'user' object does not exist in the admin section. So,

Was:
'view_all' => ( ($GLOBALS['user']->is()) ? (bool)$view_all : false ),
 
Now:
'view_all' => ( ($GLOBALS['user']->is() || ADMIN_CP) ? (bool)$view_all : false ),

This adds the condition that if CubeCart is showing an admin control panel, then honor the $view_all choice.

Share this post


Link to post
Share on other sites

That still won't work because $GLOBALS['user'] still does not exist. So:

Original:
'view_all' => (bool)$view_all,
 
Now:
'view_all' => ( (User::getInstance()->is() || ADMIN_CP) ? (bool)$view_all : false ),

Share this post


Link to post
Share on other sites

Now it works perfectly. But I observe that some visits Google lead directly to ?page=all

I could do in this case to finish solve this problem?

Share this post


Link to post
Share on other sites

In your opinion, do you think these hits from Google are "refresher" requests from having this link already in their index from a while ago?

 

If that's the case, maybe Google has a way for you to tell Google to dump everything it has ever scanned from your site, and do it all over.

Share this post


Link to post
Share on other sites

Indeed these links are indexed in google for some time. With the so-called "Sitelinks" The problem is that many of the visitors to the site come from these sitelinks.

Share this post


Link to post
Share on other sites

I don't recognize the term 'sitelinks' (not unusual for me).

 

Please look at Google's "Webmaster Tools". There should be a solution there.

 

You may also want to have CubeCart create a SiteMap (admin, Maintenance, Rebuild tab). Then tell Google about it -- CubeCart probably notifies Google anyway.

Share this post


Link to post
Share on other sites

×
×
  • Create New...