My SellerDeck Account | Newsletter | Free Trial

Community and Knowledge Base

Go Back   Sellerdeck Community > SellerDeck Ecommerce Software > SellerDeck v9/v8

Search powered by Google
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 55 votes, 5.00 average. Display Modes
  #16  
Old 13-Sep-2007, 02:07 PM
gabrielcrowe's Avatar
gabrielcrowe gabrielcrowe is offline
Registered User
Join Date: Sep 2004
Full Name: gabriel crowe
Posts: 2,886
Thanks: 8
Thanked 26 Times in 10 Posts
Quote:
Needs testing
this, is my favourite phrase. its a shame more people dont test as much as you mr fergus.
Reply With Quote
  #17  
Old 13-Sep-2007, 02:25 PM
gabrielcrowe's Avatar
gabrielcrowe gabrielcrowe is offline
Registered User
Join Date: Sep 2004
Full Name: gabriel crowe
Posts: 2,886
Thanks: 8
Thanked 26 Times in 10 Posts
is there an odbc function that counts rows? do you really have to page through the results?
Reply With Quote
  #18  
Old 13-Sep-2007, 02:31 PM
fergusw's Avatar
fergusw fergusw is offline
Registered User
Join Date: Mar 2004
Full Name: Fergus Weir
Posts: 1,583
Thanks: 75
Thanked 110 Times in 90 Posts
PHP Code:
odbc_num_rows 
would be the one you mean, however for MS Access it returns -1
Reply With Quote
  #19  
Old 13-Sep-2007, 02:40 PM
gabrielcrowe's Avatar
gabrielcrowe gabrielcrowe is offline
Registered User
Join Date: Sep 2004
Full Name: gabriel crowe
Posts: 2,886
Thanks: 8
Thanked 26 Times in 10 Posts
well, isnt that just crap-tacular.
Reply With Quote
  #20  
Old 13-Sep-2007, 06:10 PM
NormanRouxel's Avatar
NormanRouxel NormanRouxel is offline
Registered User
Join Date: Dec 2002
Full Name: Norman Rouxel
Posts: 10,752
Thanks: 9
Thanked 734 Times in 617 Posts
Fergus,

You may need some extra conditions to make sure that the Duplicate isn't deleted.

Also, are you seeing the occassional crash when exiting Actinic that Gabriel and I saw when doing this sort of ODBC stuff.
__________________
Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Reply With Quote
  #21  
Old 14-Sep-2007, 09:14 AM
fergusw's Avatar
fergusw fergusw is offline
Registered User
Join Date: Mar 2004
Full Name: Fergus Weir
Posts: 1,583
Thanks: 75
Thanked 110 Times in 90 Posts
Good point Norman. I have edited original post to add an additional function for returning number of products 'excluding' the deleted duplicates.

Regarding occasional crashes..... I've not noticed any yet! I see memory error warning and crash upon opening if I have any incorrect syntax in the actinic_main.php file, but not upon exit.... yet!
Reply With Quote
  #22  
Old 12-Mar-2008, 09:10 AM
Darren B's Avatar
Darren B Darren B is offline
Developers
Join Date: Dec 2002
Full Name: Sir Breakalot
Posts: 6,690
Thanks: 81
Thanked 69 Times in 44 Posts
Has anyone or is anyone still using this, something that was on my to do list and is still on my to do list.

If so is there anything i need to watch out for, mind you my actinic_main.php is ermm a little different to the original lol, get all fat and juicy

D
Reply With Quote
  #23  
Old 10-May-2008, 02:01 PM
gabrielcrowe's Avatar
gabrielcrowe gabrielcrowe is offline
Registered User
Join Date: Sep 2004
Full Name: gabriel crowe
Posts: 2,886
Thanks: 8
Thanked 26 Times in 10 Posts
i still am, on every site i make.

i have found it stable, and fast.

in particular, i have just added another addition to the php menu builder, that also uses flat filenames, instead of cgi-bin numbers.

much better for seo.
Reply With Quote
  #24  
Old 18-Mar-2009, 03:13 AM
AndyBorrett's Avatar
AndyBorrett AndyBorrett is offline
Registered User
Join Date: Feb 2005
Full Name: Andy Borrett
Posts: 384
Thanks: 9
Thanked 11 Times in 9 Posts
Not sure if I should have started a new thread in the v9 section, but here goes...

Has anyone managed to get this working with v9.03?

When I try it I get the following error after uploading.

Quote:
You don't have permission to access /acatalog/Fatal error: Call to undefined function Ref2file() in main on line 1 on this server.
I presume it's something to do with actinic_main.php being different
Reply With Quote
  #25  
Old 18-Mar-2009, 09:42 AM
gabrielcrowe's Avatar
gabrielcrowe gabrielcrowe is offline
Registered User
Join Date: Sep 2004
Full Name: gabriel crowe
Posts: 2,886
Thanks: 8
Thanked 26 Times in 10 Posts
this works in all versions of actinic to date. its running on loads of catalogs i'v built.

instead of putting it in an external file, try including it in a template, and including it in the header of your pages.

wrap each function in:

PHP Code:
if (!function_exists('myfunc')) {

function 
myfunc(){
// your function here
}


to avoid errors.
Reply With Quote
  #26  
Old 19-Mar-2009, 12:16 AM
AndyBorrett's Avatar
AndyBorrett AndyBorrett is offline
Registered User
Join Date: Feb 2005
Full Name: Andy Borrett
Posts: 384
Thanks: 9
Thanked 11 Times in 9 Posts
Still no joy

I have removed the extra code from Actinic_main.php

I created a new layout called PHPStuff and added the following code

Code:
if (!function_exists('GetSectFileName')) {

/***************************************************************
* 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($result, 1);  
        }
        odbc_close($connect);
            return $url;
    }
}

if (!function_exists('GetProdParent')) {

/***************************************************************
* 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($result, 1);
        }
        odbc_close($connect);
            return $parentid;

        }
	}

if (!function_exists('GetSectParent')) {

/***************************************************************
* 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($result, 1);
        }
        odbc_close($connect);
            return $parentid;
        }
}
if (!function_exists('Ref2File')) {

/***************************************************************
* 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));
}
}

if (!function_exists('Ref2ParentFile')) {

function Ref2ParentFile($ref) {
return GetSectFileName(GetSectParent(GetProdParent($ref)));
}
}
I then inserted the PHPStuff layout into the head section. This caused all sorts of warnings so I wrapped it in a block with PHP=True and Selectable=False which stopped the errors.

I then used the following in a marketing list

Code:
<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
After uploading and clicking on the Link Text I still get the following error

Code:
Forbidden
You don't have permission to access /acatalog/Fatal error: Call to undefined function Ref2file() in main on line 1 on this server.
Any more pointers to help a numpty understand?
Reply With Quote
  #27  
Old 19-Mar-2009, 12:57 AM
NormanRouxel's Avatar
NormanRouxel NormanRouxel is offline
Registered User
Join Date: Dec 2002
Full Name: Norman Rouxel
Posts: 10,752
Thanks: 9
Thanked 734 Times in 617 Posts
You have to close and restart Actinic after making any changes to actinic_main.php.
__________________
Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Reply With Quote
  #28  
Old 19-Mar-2009, 01:17 AM
AndyBorrett's Avatar
AndyBorrett AndyBorrett is offline
Registered User
Join Date: Feb 2005
Full Name: Andy Borrett
Posts: 384
Thanks: 9
Thanked 11 Times in 9 Posts
I have tried that Norman.

Just to make sure - it is Actinic_Main.php in the program files folder rather than anywhere else?
Reply With Quote
  #29  
Old 19-Mar-2009, 01:58 AM
NormanRouxel's Avatar
NormanRouxel NormanRouxel is offline
Registered User
Join Date: Dec 2002
Full Name: Norman Rouxel
Posts: 10,752
Thanks: 9
Thanked 734 Times in 617 Posts
Quote:
it is Actinic_Main.php in the program files folder rather than anywhere else
That's right.
__________________
Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Reply With Quote
  #30  
Old 19-Mar-2009, 04:20 AM
AndyBorrett's Avatar
AndyBorrett AndyBorrett is offline
Registered User
Join Date: Feb 2005
Full Name: Andy Borrett
Posts: 384
Thanks: 9
Thanked 11 Times in 9 Posts
Some progress made

I've got rid of all the errors and can get Ref2ParentFile to work.
The same can't be said of Ref2File which just appears to be empty - I have placed it outside of the href to confirm the result of this function is blank.

Here is my code to date:-

Code:
<actinic:block php="true" >
	

if (!function_exists('GetSectFileName')) {

/***************************************************************
* GetSectFileName - A support function for Ref2File
***************************************************************/

function GetSectFileName($sectref)
    {
        $connect = odbc_connect("ActinicCatalog9","","");
        $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($result, 1);  
        }
        odbc_close($connect);
            return $url;
    }
}

if (!function_exists('GetProdParent')) {

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

        }
}

if (!function_exists('GetSectParent')) {

/***************************************************************
* GetSectParent- A support function for Ref2File
***************************************************************/
function GetSectParent($sectrefs)
    {
    $prodrefs = str_replace("{","",$sectrefs);
    $prodrefs = str_replace("}","",$sectrefs);
        $connect = odbc_connect("ActinicCatalog9","","");
        $query = "SELECT [nParentSectionID] FROM [Catalog section] WHERE [nSectionID]=".$sectrefs."";
        $result = odbc_exec($connect, $query);
        while(odbc_fetch_row($result)){
            $parentid = odbc_result($result, 1);
        }
        odbc_close($connect);
            return $parentid;
        }
}
if (!function_exists('Ref2File')) {
            
function Ref2File($ref) {
return GetSectFileName(GetProdParent($ref));
}
}

if (!function_exists('Ref2ParentFile')) {

function Ref2ParentFile($ref) {
return GetSectFileName(GetSectParent(GetProdParent($ref)));
}
}
</actinic:block>
This is in a layout placed in the head section as before

This is what I have in the mini related product layout

Code:
<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
Any further ideas?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 07:25 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.