Announcement

Collapse
No announcement yet.

Best Sellers -take to section

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Best Sellers -take to section

    I am sure I have read how to do this somewhere but for the life of me I can't find it.

    I am using the mini best sellers layout on my front page and I want the link to go the section containg the product rather then the product itself.

    I am using a one product per section layout so really I want the link to go to the section above the containing section if you see what I mean.

    Any ideas?
    Andy
    Unusual Silver Jewellery
    Giftmill - Unusual Gifts
    Crystal Healing Jewellery
    Steampunk Jewellery

    #2
    The best sellers links go via the cgi-bin to the product reference - don't recall seeing a hack to change the functionality. There was a very early v8 hack from drounding on using products / spp and using PHP to test for them which may be what you have seen??


    Bikster
    SellerDeck Designs and Responsive Themes

    Comment


      #3
      Looks like I'll have to knock up some code and variables to use.

      Thanks John
      Unusual Silver Jewellery
      Giftmill - Unusual Gifts
      Crystal Healing Jewellery
      Steampunk Jewellery

      Comment


        #4
        my ref2file function can do this.

        you just need to add an extra jump in the code to traverse another section upwards:

        http://community.actinic.com/showthread.php?t=32892

        it looks like this:

        PHP Code:
        /***************************************************************
        * GetSectFileName - A support function for Ref2File
        ***************************************************************/

        function GetSectFileName($sectref)
            {
                
        $connect odbc_connect("ActinicCatalog8","","");
                
        $query "SELECT [sPageName] FROM [Catalog Section] WHERE [nSectionID]=".$sectref."";
                
        $result odbc_exec($connect$query);
                while(
        odbc_fetch_row($result)){
                    
        //$name = odbc_result($result, 2);
                    
        $url odbc_result($result1);  
                }
                
        odbc_close($connect);
                    return 
        $url;
            }

        /***************************************************************
        * GetProdParent - A support function for Ref2File
        ***************************************************************/
        function GetProdParent($prodrefs)
            {
            
        $prodrefs str_replace("{","",$prodrefs);
            
        $prodrefs str_replace("}","",$prodrefs);
                
        $connect odbc_connect("ActinicCatalog8","","");
                
        $query "SELECT [nParentSectionID] FROM [product] WHERE [Product Reference]='".$prodrefs."'";
                
        $result odbc_exec($connect$query);
                while(
        odbc_fetch_row($result)){
                    
        $parentid odbc_result($result1);
                }
                
        odbc_close($connect);
                    return 
        $parentid;

                }

        /***************************************************************
        * GetSectParent- A support function for Ref2File
        ***************************************************************/
        function GetSectParent($sectrefs)
            {
            
        $prodrefs str_replace("{","",$sectrefs);
            
        $prodrefs str_replace("}","",$sectrefs);
                
        $connect odbc_connect("ActinicCatalog8","","");
                
        $query "SELECT [nParentSectionID] FROM [Catalog section] WHERE [nSectionID]=".$sectrefs."";
                
        $result odbc_exec($connect$query);
                while(
        odbc_fetch_row($result)){
                    
        $parentid odbc_result($result1);
                }
                
        odbc_close($connect);
                    return 
        $parentid;
                }

        /***************************************************************
        * Ref2file - Use Actinic's pwn database, to convert a prod ref, to a filename
        * @param int $ref the product reference.
        * @author Gabriel Crowe + NormanRouxel 08 September 2007
        *
        * usage example:
        <a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
        ***************************************************************/
                    
        function Ref2File($ref) {
        return 
        GetSectFileName(GetProdParent($ref));
        }
        function 
        Ref2ParentFile($ref) {
        return 
        GetSectFileName(GetSectParent(GetProdParent($ref)));

        please note that in this version, i have added another function: 'GetSectParent' that gets the parent of the section passed to it.

        good luck.

        Comment


          #5
          btw, with this function, you make a link, thus:
          HTML Code:
          <a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2ParentFile($("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>

          Comment


            #6
            Thanks for that Gabriel.
            I tried it and it seems to work OK, then I noticed the part of your post that says it may crash Actinic so I took it out again and knocked up some code and variables.
            Now our site is up and running ( www.seriouslysilver.co.uk ) I will probably go back to your method and give it another try.
            Unusual Silver Jewellery
            Giftmill - Unusual Gifts
            Crystal Healing Jewellery
            Steampunk Jewellery

            Comment


              #7
              I noticed the part of your post that says it may crash Actinic
              That was me - about 9 months ago when V8 was relatively young. Actinic has had many bugfixes since then so it may be useful for someone to say whether they're seeing any such problems on the 8.5.x version.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                I'm using version 9 here so I will give it a try in a week or so once I've finished tweaking the new site.
                Unusual Silver Jewellery
                Giftmill - Unusual Gifts
                Crystal Healing Jewellery
                Steampunk Jewellery

                Comment

                Working...
                X