Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1
    Join Date
    Jan 2011
    Posts
    339
    Plugin Contributions
    0

    Default What's The Easiest Way To Create A Direct Link In The Sidebox?

    Working on a new bookseller site, www.book-oasis.com. The owner wants the last two categories (http://book-oasis.com/index.php?main_page=index&cPath=7 and http://book-oasis.com/index.php?main_page=index&cPath=8) to redirect to different sites. Is there an easy way to do this?

    Many thanks, in advance, for your assistance!!

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,690
    Plugin Contributions
    9

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    well, i suppose it will all depend on which template you are using and what script is creating the url. most likely, i think you could modify:

    includes/templates/YOUR_TEMPLATE/sideboxes/tpl_categories.php

    from within that script you could add change the following line:

    PHP Code:
    $content .= '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT.'&pg=store'$box_categories_array[$i]['path']) . '">'
    to something like
    PHP Code:
    if ($box_categories_array[$i]['path'] == 'cPath=7') {
          
    $content .= '<a class="' $new_style '"  href=\"www.somewhereawayfrombookoasis.com\">';
    } else {
          
    $content .= '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT.'&pg=store'$box_categories_array[$i]['path']) . '">';

    if that does not more work, i would look to see if your site has the following files:

    includes/classes/categories_ul_generator.php
    includes/classes/categories_ul_generator_template.php

    if they are there, you might need to modify those files instead.

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jan 2011
    Posts
    339
    Plugin Contributions
    0

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    This is the closest I've been able to find. I think it's what you were referring to; it just has that <div class> code inserted in it, which made finding it a real pain.


    $content .= '<div class="betterCategories"><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    if ($box_categories_array[$i]['current']) {
    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= '<span class="category-subs-parent">';
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'down', $spacer);
    $content .= '</span>';
    } else {
    $content .= '<span class="category-subs-selected">';
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub', $spacer);
    $content .= '</span>';
    }
    } else {
    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'right', $spacer); }
    else {
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub', $spacer); }
    }


    To be perfectly honest, I'm scared to death to mess with it. I never understood php, and it's been a long time since I've worked with it. I'm not sure where I should add...whatever it is I'm supposed to add...let alone add it twice for two separate links. :-/

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,690
    Plugin Contributions
    9

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    DK,
    few things; when posting code on the forum, use square brackets with 'php' or 'code' inside of the brakets. and then end the code section again with the square brackets and a slash and the appropriate tag as the ending tag. it makes it much easier to read (and i'm sure there are notes on it somewhere). 2nd, make a backup of the code, prior to making any changes. this is not rocket science so as long as you can go back from where you came you should be fine.

    from what you are posting i think you only need to change the first line. try changing the first line to the following lines and let us know how it goes:

    PHP Code:
    if ($box_categories_array[$i]['path'] == 'cPath=7') {
        
    $content .= '<div class="betterCategories"><a class="' $new_style '" href=\"www.somewhereawayfrombookoasis.com\">';
    } elseif (
    $box_categories_array[$i]['path'] == 'cPath=8') {
        
    $content .= '<div class="betterCategories"><a class="' $new_style '" href=\"www.somewhereawayfrombookoasis.com\">';
    } else {
        
    $content .= '<div class="betterCategories"><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Jan 2011
    Posts
    339
    Plugin Contributions
    0

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    I'll try to remember that formatting tip when pasting code, thanks. (Though between you and me, I don't think there's anything that can make it look easier to read. LOL)

    Once I changed href=\"www.timelesserotica.com\" to href="http://www.timelesserotica.com\" it worked perfectly. THANK YOU SO VERY MUCH!!!!!!!!!!!!!!!!!!!!!

  6. #6
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    Quote Originally Posted by carlwhat View Post
    DK,
    few things; when posting code on the forum, use square brackets with 'php' or 'code' inside of the brakets. and then end the code section again with the square brackets and a slash and the appropriate tag as the ending tag. it makes it much easier to read (and i'm sure there are notes on it somewhere).
    Umm yeah. In the posting tips that appear above every new post unless using the mobile template to access this forum site... Basically the 9th bullet or the links in the last paragraph. I thought the terminology was a bit different in the past to include posting code, but perhaps it got modified again like the language section did a while back...

    Question about this solution, is it the last two possible categories, a specific set of categories that are to redirect, or simply the last two options displayed in the list?

    What happens when/if the categories get deleted, or repurposed? Okay, not really what will happen, but what would be desired to happen? What if a new category is created?

    As far as the link as it was provided, it was missing either the (as I've been told) rarely used relational double slash, or the applicable prefix of http:// or https://. The choice taken was to hard code http://. Also could have generated an ez-page that could be referenced in a similar manner but the uri of the ez-page can be modified from within the admin rather than requiring ftp to the file(s) above...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jan 2011
    Posts
    339
    Plugin Contributions
    0

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    MC, in this case, it's two specific category listings that just happen to be listed last. I made sure to associate the code changes with the actual category numbers so that if another category was added below (though I wouldn't list it below, as I want those two categories to be listed last), the refresh commands would not be affected.

    Thanks again, everyone, for your help; we're very grateful to have solved this puzzle!!

  8. #8
    Join Date
    Jan 2011
    Posts
    339
    Plugin Contributions
    0

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    Okay, I tried the same trick with another site, but it didn't work. Can anyone please help me figure out what I did wrong?

    I inserted this block of code (identical to the first except the cPaths and urls are changed):

    PHP Code:
    if ($box_categories_array[$i]['path'] == 'cPath=16') { 
        
    $content .= '<div class="betterCategories"><a class="' $new_style '" href="http://www.book-oasis.com\">'
    } elseif (
    $box_categories_array[$i]['path'] == 'cPath=17') { 
        
    $content .= '<div class="betterCategories"><a class="' $new_style '" href="http://www.carnal-pleasures.com\zencart\">'
    just above:

    PHP Code:
    } else { 
    $content .= '<div class="betterCategories"><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';
    if (
    $box_categories_array[$i]['current']) {
    if (
    $box_categories_array[$i]['has_sub_cat']) {
    $content .= '<span class="category-subs-parent">';
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'down'$spacer);
    $content .= '</span>';
    } else {
    $content .= '<span class="category-subs-selected">';
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub'$spacer);
    $content .= '</span>';
    }
    } else {
    if (
    $box_categories_array[$i]['has_sub_cat']) { 
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'right'$spacer); }
    else { 
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub'$spacer); }

    Am I putting it in the wrong place?

    Many thanks, in advance, for your assistance!!

  9. #9
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    Quote Originally Posted by DK_Scully View Post
    Is there an easy way to do this?
    Heck yes, and far simpler than the suggestions already made.

    I'm going to hate myself for this - but the 'easy' solution summed up in one word '.htaccess'.

    Something like

    Redirect 301 /index.php?main_page=index&cPath=8 http://someothersite.com
    Redirect 301 /index.php?main_page=index&cPath=7 http://someothersite.com/something/

    Cheers
    RodG

  10. #10
    Join Date
    Jan 2011
    Posts
    339
    Plugin Contributions
    0

    Default Re: What's The Easiest Way To Create A Direct Link In The Sidebox?

    I'll try it! Which copy of .htaccess should I modify? So far the only copy I've found is in the /includes/ folder, and adding:

    PHP Code:
    Redirect 301 /index.php?main_page=index&cPath=16 http://book-oasis.com
    Redirect 301 /index.php?main_page=index&cPath=17 http://carnal-pleasures.com/zencart/ 
    to the end of it didn't do anything at all.
    Last edited by DK_Scully; 28 Jan 2016 at 07:33 AM.

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. The Quickest and Easiest way to work out what does what on the CSS style sheet
    By janissaire in forum Templates, Stylesheets, Page Layout
    Replies: 47
    Last Post: 5 Jul 2012, 03:05 AM
  2. What's the easiest way to add custom fields to the New Product page?
    By christopherw in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 18 Sep 2007, 06:16 PM
  3. What is the easiest way to add an extra sidebox and make some html pages in it?
    By hankliu in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 27 Dec 2006, 10:48 AM
  4. Whats the easiest way to create a newsletter??
    By Diva in forum General Questions
    Replies: 5
    Last Post: 27 Jul 2006, 09:08 AM
  5. Shipping, what is the easiest way
    By jcoit1 in forum Managing Customers and Orders
    Replies: 1
    Last Post: 11 Jul 2006, 01:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR