Announcement

Collapse
No announcement yet.

Bypassing cgi-bin links solution 2 - community collaboration.

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

    #31
    After several days of trying to understand how the code works and even buying a book on Perl I think I've found the problem.

    The code appears to work fine - it's the database that doesn't hold the information the code is requesting.

    Code:
    $connect = odbc_connect("ActinicCatalog9","","");
            $query = "SELECT [sPageName] FROM [Catalog Section] WHERE [nSectionID]=".$sectref."";
    If I open up the database in Access and look in the table Catalog Section there are no records in sPageName apart from where I have specified a page name within Actinic.
    I don't know if this is normal but I let Actinic generate its own pagenames for all my products to help with SEO.

    The only table I can find the actual page name is FileList and I can't see any relationship to either the product or the section in there.
    Does anyone know how these are linked or how I can get Actinic to populate the sPageName records?
    Unusual Silver Jewellery
    Giftmill - Unusual Gifts
    Crystal Healing Jewellery
    Steampunk Jewellery

    Comment


      #32
      I believe the solution posted in this thread nearly solves my problem but I don't know how to modify it to do so. Can anyone help?

      In any given section I want to display the section images of it's siblings.

      E.g. In the example below, if I am on section "Sect AB" I would see section images of "Sect AA", "Sect AC" and "Sect AD"

      Sect A
      Sect AA
      Sect AB
      Sect AC
      Sect AD
      Sect B
      Sect BA
      Sect BB
      Sect C

      I have tried to find a ParentSectionID variable but this does not seem to exist.The code in this thread would seem to offer the solution. How would I modify it or is there a better way?

      Thanks

      Comment


        #33
        Have read through the block tutorials by Gabe on the forum? You can probably do what you want using a ChildSectionList block
        Unusual Silver Jewellery
        Giftmill - Unusual Gifts
        Crystal Healing Jewellery
        Steampunk Jewellery

        Comment


          #34
          Originally posted by gabrielcrowe View Post
          include this code at the end of your actinic_main.php then restart actinic.

          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)));

          HTML Code:
          <a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
          then make a link like this, wherever a product reference is in context, such as a marketing item.

          To get the parent of the section your item is in (for single product per page lists) then make a link like this:
          HTML Code:
          <a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2ParentFile("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
          This will traverse up another level.


          what does the code do? basically, it uses actinics own database to find the name of the section that pertains to a product. by using the product reference. The code may cause some slowdown on larger shops, but really, all it does is convert the prodref, to the filename online.

          note:
          **EXPERIMENTAL** causes some errors occasionally when actinic closes. Other than that, how about some testing and input?

          special thanks go to NormanRouxel for the initial code.
          Can i use this to link a fragment??
          i got a sliding menu on my index that goes through the cgi bin, is it possible to link this directly??



          <actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentImageFileName%22%20%2f%3e%20%21%3d%20%22%22" >
          <li>
          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentImageALink%22%20%2f%3e" >
          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentLinkToURL%22%20%2f%3e" >
          <a href="<actinic:variable name="FragmentLinkedItemID" />">
          </actinic:block>
          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentLinkToProduct%22%20%2f%3e" >
          <a href="<actinic:variable name="SearchCGIURL" />?PRODREF=<actinic:variable name="FragmentLinkedItemID" /><actinic:block if="%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e" >&amp;SHOP=<actinic:variable name="ShopID" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e">&amp;NOLOGIN=1</actinic:block>">
          </actinic:block>
          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentLinkToSection%22%20%2f%3e" >
          <a href="<Actinic:Variable Name="SearchCGIURL"/>?SECTIONID=<actinic:variable name="FragmentLinkedItemID" /><actinic:block if="%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e">&amp;SHOP=<Actinic:Variable Name="ShopID"/></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e">&amp;NOLOGIN=1</actinic:block>">
          </actinic:block>
          </actinic:block>
          <img src="<actinic:variable name="FragmentImageFileName" />" height="200" width="325" alt="<actinic:variable encoding="strip" name="FragmentTitle" />">
          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentImageALink%22%20%2f%3e" >
          </a>
          </actinic:block>
          <h2><actinic:variable encoding="strip" name="FragmentTitle" /></h2>
          <p> <actinic:variable encoding="actinic" name="FragmentText" /></p>
          </li>
          </actinic:block>



          thanks in advance, lee
          http://www.novadetox.co.uk

          Comment


            #35
            If you mean link to a Brochure page, then all you need is:
            Code:
            <a href="<actinic:variable name="BrochurePageURL" />"><actinic:variable name="BrochureName" /></a>
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #36
              Originally posted by NormanRouxel View Post
              If you mean link to a Brochure page, then all you need is:
              Code:
              <a href="<actinic:variable name="BrochurePageURL" />"><actinic:variable name="BrochureName" /></a>
              actually need to link to product from brochure fragment

              also lost the preview of the whole site, and online preview not working aslo??

              however the cosde is working for the marketing list.

              i want to add it to the code for the slide on th efront page of th esite,

              http://www.novadetox.co.uk

              cheers, lee
              http://www.novadetox.co.uk

              Comment


                #37
                Nothing helpful to add, but I've just tried this and it works a treat in V9

                Thanks chaps!
                The Patchwork Rabbit

                Comment


                  #38
                  Why hasn't this been developed to come out of the box in v10?

                  This would be great if I could get it to work.
                  I've tried a few times now but always get the same error, no doubt I'm a duffus and should see something glaringly wrong but in v10 in preview mode (not going live unless someone tells me it sorts it's self by publishing live) the links fro SPP return:

                  Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 354 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 356 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 357 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 360 Notice: Undefined variable: parentid in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 361 Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 372 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 374 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 375 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 378 Notice: Undefined variable: parentid in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 379 Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 336 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 338 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 339 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 343 Notice: Undefined variable: url in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 344
                  p.s lines
                  $connect = odbc_connect("ActinicCatalog8","","");
                  Should this be the version number of actinic? in any case I tried with 8 without and with 10 all with the same result.

                  Any thoughts?... or will actinic get around to adding this as standard to new releases.

                  Regards
                  Bangers
                  Boxhedge New Media Design
                  Design and development solutions for SME's.
                  Tel: 0118 966 2786
                  Examples of work can be found at http://www.boxhedge.com

                  Comment


                    #39
                    I can't comment on your code but the 8 does indeed need changing to 10 for the Actinic version.

                    Comment


                      #40
                      See http://community.actinic.com/showthread.php?t=48787 post #4, where earlier today I suggested two tweaks (to different code) that make it survive Actinic upgrades and also make it version number independent.

                      Should be easy to apply the same ideas to the above.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #41
                        Um...apologies...
                        Just gave it one last shot, why not I thought after drounding replied so promptly. And well lets just say it works...leave it at that.
                        possibly didn't completely try it as $connect = odbc_connect("ActinicCatalog10","",""); maybe one forgot to close actinic and reopen..hmmm, sorry.

                        Anyway all good, amazing, sorts out major actinic flaw. I'll checkout Norman's update but thanks to Gabe for thinking outside the box.

                        p.s Thanks to Drounding for reply.

                        Cheers
                        A happy bangers
                        Boxhedge New Media Design
                        Design and development solutions for SME's.
                        Tel: 0118 966 2786
                        Examples of work can be found at http://www.boxhedge.com

                        Comment


                          #42
                          Forget v10 cleaner cart/checkout aside, had actinic announced this with v10 launch and they may have had more enthusiasm for the update.

                          This is major as far as I am concerned and should be AUG asap.

                          Regards
                          bangers
                          Boxhedge New Media Design
                          Design and development solutions for SME's.
                          Tel: 0118 966 2786
                          Examples of work can be found at http://www.boxhedge.com

                          Comment


                            #43
                            been trying to implement this bit of php code because the code I wrote didn't work , so I used this example and I run into difficulties every so often.
                            I think ? narrowed it down to any product reference with a hyphen in, so for instance, "tc005" - ok, "Xeryu" - ok, "g5-classic" - NO GO
                            I've experimented with others and anything without hyphens seems to be fine, but the moment I use the hyphens, then it can't find the parentID from within GetProdParent()

                            Am I missing something, or do I need to "translate" it into html entitites before calling the ODBC link ?

                            kev

                            Comment


                              #44
                              If i now try to use this on Sellerdeck 2013, is it still valid?

                              Do i just change the version number, or has ActinicCatalog also changed

                              ("ActinicCatalog8","",""); change this to ("ActinicCatalog12","",""); or ("Sellerdeck12","","");

                              Sellerdeck, can you not just include this in the future?
                              Regards

                              Jason

                              Titan Jewellery (Swift Design)
                              Damascus Steel Rings

                              Comment


                                #45
                                ActinicCatalog12 is what's used for SD 2103. Also see post #40 above that links to a way to make it version independent.
                                Norman - www.drillpine.biz
                                Edinburgh, U K / Bitez, Turkey

                                Comment

                                Working...
                                X