A bit of development I thought I'd share...
The following modification will populate a section in Actinic with all products in the catalog that have matching Attribute and Choice values. This is useful when wanting to have sections with perhaps clothing of specific colours or sizes from across all sections in the catalog.
---------------------------------------
Notes:
This will only work with Attributes and Choices, not with any Components and Permutations.
Duplicates are excluded.
On a large catalog the Section may take a short while to generate on preview and on upload, it may also result in a large page depending on the number of results.
The code is written for v10 but can easily be changed for different versions.
The method can easily be duplicated for other Attribute and Choices in other sections.
The code I'm sure can be neated and optimised but that's another day.
---------------------------------------
Continue at your own risk and Backup first!
---------------------------------------
Backup!
Create new variables, Attribute1 and Choice1, set their Place of Setting as Site.
Make a backup copy of actinic_main.php in the C:\Program Files\Actinic v10 directory.
Edit the actinic_main.php file and add the following line at the end of the file just before ?>
Create a new text file.
Place the following inside the file and save it as custom.php to the C:\Program Files\Actinic v10 directory:
Close and Open Actinic
In Settings - Site Options set Attribute1 to the value of the required Attribute name in Actinic
In Settings - Site Options set Choice1 to the value of the required Choice name in Actinic
Create a new Product List, name it as 'Product List Choice1' and add the following contents:
Create a new Secion in Actinic and add a new dummy product
Set the Section Layout - Product List Layout to be the new product list layout 'Product List Choice1'
Note that you may need to compact and close and open Actinic to see the results.
---------------------------------------
Et Voila - you now have a section with all products of say Attribute 'Size' and say Choice '6 x 4' from across the catalog.
The following modification will populate a section in Actinic with all products in the catalog that have matching Attribute and Choice values. This is useful when wanting to have sections with perhaps clothing of specific colours or sizes from across all sections in the catalog.
---------------------------------------
Notes:
This will only work with Attributes and Choices, not with any Components and Permutations.
Duplicates are excluded.
On a large catalog the Section may take a short while to generate on preview and on upload, it may also result in a large page depending on the number of results.
The code is written for v10 but can easily be changed for different versions.
The method can easily be duplicated for other Attribute and Choices in other sections.
The code I'm sure can be neated and optimised but that's another day.
---------------------------------------
Continue at your own risk and Backup first!
---------------------------------------
Backup!
Create new variables, Attribute1 and Choice1, set their Place of Setting as Site.
Make a backup copy of actinic_main.php in the C:\Program Files\Actinic v10 directory.
Edit the actinic_main.php file and add the following line at the end of the file just before ?>
Code:
include_once("custom.php");
Place the following inside the file and save it as custom.php to the C:\Program Files\Actinic v10 directory:
Code:
<?php function GetChoiceTrue($prodid, $att, $choice) { global $answer1; global $answer2; $connect = odbc_connect("ActinicCatalog10","",""); $query1 = "SELECT [nPropertyID] FROM [ProductProperties] WHERE (([sProductRef]='".$prodid."') AND ([sString1]='".$att."'))"; $result1 = odbc_exec($connect, $query1); while(odbc_fetch_row($result1)){ $answer1 = odbc_result($result1, 1); } odbc_close($connect); $connect = odbc_connect("ActinicCatalog10","",""); $query2 = "SELECT [sProductRef] FROM [ProductProperties] WHERE (([sString1]='".$choice."') AND ([nParentPropertyID]=$answer1))"; $result2 = odbc_exec($connect, $query2); while(odbc_fetch_row($result2)){ $answer2 = odbc_result($result2, 1); } odbc_close($connect); return $answer2; } ?>
In Settings - Site Options set Attribute1 to the value of the required Attribute name in Actinic
In Settings - Site Options set Choice1 to the value of the required Choice name in Actinic
Create a new Product List, name it as 'Product List Choice1' and add the following contents:
Code:
<actinic:block type="EntireSectionList" > <actinic:block type="ProductList" > <actinic:block php="true"> $sChoiceTrue1 = GetChoiceTrue("<actinic:variable name="ProductID" selectable="false" encoding="perl"/>","<actinic:variable name="Attribute1" selectable="false" encoding="perl"/>","<actinic:variable name="Choice1" selectable="false" encoding="perl"/>"); </actinic:block> <actinic:block if="%24sChoiceTrue1%20%3d%3d%20%3cactinic%3avariable%20name%3d%22ProductID%22%20selectable%3d%22false%22%20encoding%3d%22perl%22%2f%3e%20AND%20%3cactinic%3avariable%20name%3d%22ProductType%22%20%2f%3e%20%3d%3d%200" > <actinic:variable name="ProductLayout" /> </actinic:block> </actinic:block> </actinic:block>
Set the Section Layout - Product List Layout to be the new product list layout 'Product List Choice1'
Note that you may need to compact and close and open Actinic to see the results.
---------------------------------------
Et Voila - you now have a section with all products of say Attribute 'Size' and say Choice '6 x 4' from across the catalog.
Comment