Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfcomponent extends="farcry.core.packages.types.types" displayname="Products"
- hint="Products for the site"
- bSchedule="true" bFriendly="true" fualias="products"
- bObjectBroker="true">
- <cfproperty
- name="Name" type="string" hint="Product Name." required="no" default=""
- ftseq="1" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Name" ftvalidation="required" />
- <cfproperty
- name="Sku" type="string" hint="SKU number." required="no" default=""
- ftseq="4" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Sku" />
- <cfproperty
- name="ListPrice" type="string" required="no" default=""
- ftseq="6" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="List Price" ftstyle="width:100px;" />
- <cfproperty
- name="AskingPrice" type="string" required="no" default=""
- ftseq="7" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Asking Price" ftstyle="width:100px;" />
- <cfproperty
- name="SalePrice" type="string" required="no" default=""
- ftseq="8" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Sale Price" ftstyle="width:100px;" />
- <cfproperty
- name="Weight" type="string" hint="Product Weight." required="no" default=""
- ftseq="9" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Weight" ftstyle="width:100px;" />
- <cfproperty
- name="aManuf" type="uuid" required="no" default=""
- ftseq="10" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Manufacturer"
- ftJoin="manufacturer" bSyncStatus="true" ftJoinAllowDuplicates="false" />
- <cfproperty ftseq="11" ftfieldset="Main Details" ftwizardStep="Main Details" name="modelCat" type="longchar"
- hint="categorisation." required="no" default="" fttype="category" ftAlias="productcats"
- ftlabel="Category" />
- <cfproperty ftseq="12" ftfieldset="Main Details" ftwizardStep="Main Details" name="prodSize" type="longchar"
- hint="categorisation." required="no" default="" fttype="category" ftAlias="size"
- ftlabel="Size" />
- <cfproperty ftseq="13" ftfieldset="Main Details" ftwizardStep="Main Details" name="prodFlavor" type="longchar"
- hint="categorisation." required="no" default="" fttype="category" ftAlias="flavor"
- ftlabel="Flavor" />
- <cfproperty
- name="available" type="boolean" required="no" default=""
- ftseq="14" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Available" />
- <cfproperty
- name="Featured" type="boolean" required="no" default=""
- ftseq="15" ftfieldset="Main Details" ftwizardStep="Main Details" ftlabel="Featured Product" />
- <cfproperty
- name="Quantity" type="string" hint="Product Quantity." required="no" default=""
- ftseq="17" ftfieldset="Addtinonal Details" ftwizardStep="Addtinonal Details" ftlabel="Quantity" />
- <cfproperty
- name="displayMethod" type="string" hint="Display method to render." required="yes" default="displayPageStandard"
- ftseq="20" ftfieldset="Addtinonal Details" ftwizardStep="Addtinonal Details" ftlabel="Content Template"
- fttype="webskin" ftprefix="displayPage" />
- <cfproperty
- name="publishDate" type="date" hint="The date that a news object is sent live and appears on the public website" required="no" default=""
- ftseq="22" ftfieldset="Publishing Details" ftwizardStep="Addtinonal Details" ftlabel="Go Live Date"
- ftType="datetime" ftDefaultType="Evaluate" ftDefault="now()" ftDateFormatMask="dd mmm yyyy" ftTimeFormatMask="hh:mm tt" ftToggleOffDateTime="false" />
- <cfproperty
- name="expiryDate" type="date" hint="The date that a news object is removed from the web site" required="no" default=""
- ftseq="23" ftfieldset="Publishing Details" ftwizardStep="Addtinonal Details" ftlabel="Expire Product Date"
- ftType="datetime" ftDefaultType="Evaluate" ftDefault="DateAdd('yyyy', 200, now())" ftDateFormatMask="dd mmm yyyy" ftTimeFormatMask="hh:mm tt" ftToggleOffDateTime="true" />
- <cfproperty
- name="teaserImage" type="UUID" hint="Teaser image to display." required="no" default=""
- ftseq="30" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Teaser Image"
- fttype="uuid" ftjoin="dmImage"
- fthelptitle="Teaser Requirements"
- fthelpsection="Teaser images can only be selected from the pool of associated media images. You must add to the media library before selecting." />
- <cfproperty
- name="Teaser" type="longchar" hint="Teaser text." required="no" default=""
- ftseq="31" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Story Teaser" />
- <cfproperty
- name="Body" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="32" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Comparison"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="Description" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="33" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Description"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="Benefits" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="34" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Benefits"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="Ingredients" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="35" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Ingredients"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="RecommendedUse" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="36" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Usage"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="ProdLabel" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="37" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Prod Label"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="Advantages" type="longchar" hint="Main body of content." required="no" default=""
- ftseq="38" ftfieldset="Product Body" ftwizardStep="Product Body" ftlabel="Advantages"
- ftType="RichText"
- ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
- ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML"
- ftTemplateWebskinPrefixList="insertHTML" />
- <cfproperty
- name="weight" type="string" hint="" required="no" default=""
- ftseq="40" ftfieldset="Main Details" ftwizardStep="Model Details" ftlabel="Year" ftstyle="width:25px;" />
- <cfproperty
- name="aModelIds" type="array" hint="Models that match main battery type." required="no" default=""
- ftseq="47" ftfieldset="Main Details" ftwizardStep="Model Details" ftlabel="Models"
- ftJoin="mdwModel" bSyncStatus="true" ftJoinAllowDuplicates="false" />
- <cfproperty
- name="aObjectIds" type="array" hint="Mixed media content for this content." required="no" default=""
- ftseq="50" ftfieldset="Main Details" ftwizardStep="Model Details" ftlabel="Attached Media Library"
- ftJoin="dmImage" bSyncStatus="true" ftJoinAllowDuplicates="false" />
- <cfproperty
- name="fuName" type="string" hint="" required="no" default=""
- ftseq="200" ftfieldset="Main Details" ftwizardStep="Model Details" ftlabel="Friendly Name" />
- <!--- system attribute --->
- <cffunction name="AfterSave" access="public" output="false" returntype="void">
- <cfargument name="stProperties" required="yes" type="struct" hint="A structure containing the contents of the properties that were saved to the object.">
- <cfset var oProd=createobject("component",application.stCOAPI.product.packagepath)>
- <cfset var tmp=application.fc.lib.objectbroker.init(bFlush=true)>
- <!--->
- <cfset var nullObj=oProd.indexItem(stProperties.objectid)>
- --->
- </cffunction>
- <cffunction name="indexItem" access="public" output="false" returntype="void">
- <cfargument name="objectid" required="yes" type="string">
- <cfthread action="run" name="prod_#createuuid()#" objectid="#arguments.objectid#">
- <cfset var q=querynew("meh")>
- <cfquery datasource="battery_farcry" name="q" >
- SELECT objectid
- FROM product
- where objectid="#objectid#"
- </cfquery>
- <cfset var oProd=createobject("component",application.stCOAPI.product.packagepath)>
- <cfset var oModel=createobject("component",application.stCOAPI.mdwModel.packagepath)>
- <cfset var oManuf=createobject("component",application.stCOAPI.manufacturer.packagepath)>
- <cfset var oCat=createobject("component",application.stCOAPI.dmcategory.packagepath)>
- <cfset var curLoc=ExpandPath('/import')>
- <cfset var i=0>
- <cfset var qryNewPrd=querynew('objectid,
- prodName,
- prodVolt,
- prodAmp,
- prodWeight,
- prodConnect,
- prodComp,
- prodDantonaDet,
- prodDimension,
- prodYear,
- manufName,
- catName,
- modelName,
- modelDet,
- modelDet2,
- modelYear,
- modelCC,
- modelWeight,
- combineName,
- combineManufName,
- combineManufProd')>
- <cfloop query="q" >
- <cfset var stProd=oProd.getData(q.objectid)>
- <cfset var aMod=arraynew(1)>
- <cfset var myXML="">
- <cfif arraylen(stProd.amodelids)>
- <cfloop from="1" to="#arraylen(stProd.amodelids)#" index="i">
- <cftry>
- <cfset var stModel=oModel.getData(stProd.amodelids[i])>
- <cfset var stManuf=oManuf.getData(stModel.aManuf)>
- <cfset var stCat=oCat.getData(stModel.modelCat)>
- <cfscript>
- QueryAddRow(qryNewPrd,1);
- querysetcell(qryNewPrd,"objectid",'#stModel.objectid#~#stprod.objectid#');
- querysetcell(qryNewPrd,"prodName","#replace(stProd.name,'&','&','ALL')#");
- querysetcell(qryNewPrd,"prodVolt",'#stProd.volts#');
- querysetcell(qryNewPrd,"prodAmp",'#stProd.amps#');
- querysetcell(qryNewPrd,"prodWeight",'#stProd.weight#');
- querysetcell(qryNewPrd,"prodConnect","#replace(stProd.connector,'&','&','ALL')#");
- querysetcell(qryNewPrd,"prodComp","#replace(stProd.composition,'&','&','ALL')#");
- querysetcell(qryNewPrd,"prodDantonaDet","#REReplaceNoCase(stprod.dantonaDetail,'[\r\n]',"",'all')#");
- querysetcell(qryNewPrd,"prodDimension","#stprod.dimension#");
- querysetcell(qryNewPrd,"prodYear","#stprod.year#");
- querysetcell(qryNewPrd,"manufName","#replace(stManuf.name,'&','&','ALL')#");
- querysetcell(qryNewPrd,"catName","#replace(stCat.CATEGORYLABEL,'&','&','ALL')#");
- querysetcell(qryNewPrd,"modelName","#replace(stmodel.modelname,'&','&','ALL')#");
- querysetcell(qryNewPrd,"modelDet","#replace(stmodel.details1,'&','&','ALL')#");
- querysetcell(qryNewPrd,"modelDet2","#replace(stmodel.details2,'&','&','ALL')#");
- querysetcell(qryNewPrd,"modelYear","#stmodel.year#");
- querysetcell(qryNewPrd,"modelCC","#stmodel.cc#");
- querysetcell(qryNewPrd,"modelWeight","#stmodel.weight#");
- querysetcell(qryNewPrd,"combineName","#replace(stManuf.name,'&','&','ALL')# #replace(stmodel.modelname,'&','&','ALL')# #replace(stProd.name,'&','&','ALL')#");
- querysetcell(qryNewPrd,"combineManufName","#replace(stManuf.name,'&','&','ALL')# #replace(stmodel.modelname,'&','&','ALL')#");
- querysetcell(qryNewPrd,"combineManufProd","#replace(stManuf.name,'&','&','ALL')# #replace(stProd.name,'&','&','ALL')#");
- </cfscript>
- <cfcatch></cfcatch>
- </cftry>
- </cfloop>
- </cfif>
- </cfloop>
- <cfindex
- collection="new_battery"
- action="update"
- query="qryNewPrd"
- type="custom"
- key="objectid"
- body="objectid,prodName,prodVolt,prodAmp,prodWeight,prodConnect,prodComp,prodDantonaDet,prodDimension,prodYear,manufName,catName,modelName,modelDet,modelDet2,modelYear,modelCC,modelWeight,combineName,combineManufName"
- title="combineName"
- custom1="combineName"
- custom2="combineNameManuf"
- custom3="combineManufProd"
- custom4="prodName"
- />
- <cffile action="write" file="#curLoc#/xmlDoc.txt" output="<add>">
- <cfloop query="q">
- <cfset stProd=oProd.getData(q.objectid)>
- <cfset aMod=arraynew(1)>
- <cfset myXML="">
- <cftry>
- <cfif arraylen(stProd.amodelids)>
- <cfloop from="1" to="#arraylen(stProd.amodelids)#" index="i">
- <cfset stModel=oModel.getData(stProd.amodelids[i])>
- <cfset stManuf=oManuf.getData(stModel.aManuf)>
- <cfset stCat=oCat.getData(stModel.modelCat)>
- <cfsavecontent variable="myXML">
- <cfoutput>
- <doc>
- <field name="id">#stModel.objectid#</field>
- <field name="prodName">#replace(stProd.name,'&','&','ALL')#</field>
- <field name="prodVolts">#stProd.volts#</field>
- <field name="prodAmps">#stProd.amps#</field>
- <field name="prodWeight">#stProd.weight#</field>
- <field name="prodConnector">#replace(stProd.connector,'&','&','ALL')#</field>
- <field name="prodComposition">#replace(stProd.composition,'&','&','ALL')#</field>
- <field name="prodDantonaDetail">#REReplaceNoCase(stprod.dantonaDetail,"[\r\n]","",'all')#</field>
- <field name="prodDantonaBat">#stprod.dantonaBat#</field>
- <field name="prodDimension">#stprod.dimension#</field>
- <field name="prodYear">#stprod.year#</field>
- <field name="manufName">#replace(stManuf.name,'&','&','ALL')#</field>
- <field name="catName">#replace(stCat.CATEGORYLABEL,'&','&','ALL')#</field>
- <field name="modelName">#replace(stmodel.modelname,'&','&','ALL')#</field>
- <field name="modelDetails1">#replace(stmodel.details1,'&','&','ALL')#</field>
- <field name="modelDetails2">#replace(stmodel.details2,'&','&','ALL')#</field>
- <field name="modelYear">#stmodel.year#</field>
- <field name="modelCC">#stmodel.cc#</field>
- <field name="modelWeight">#stmodel.weight#</field>
- </doc>
- </cfoutput>
- </cfsavecontent>
- <cffile action="append" file="#curLoc#/xmlDoc.txt" output="#myXML#">
- </cfloop>
- </cfif>
- <cfcatch><cfdump var="#cfcatch#"></cfcatch>
- </cftry>
- </cfloop>
- <cffile action="append" file="#curLoc#/xmlDoc.txt" output="</add>">
- <cfset var meh="">
- <cfhttp url="http://#cgi.http_host#/import/uploadXML.cfm" method="post" result="meh">
- </cfthread>
- </cffunction>
- </cfcomponent>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement