Some old code laying around, decided I would release it. This was done on 3.5.x so it may need revamping for 4.0.x.
This mod will give you a drop down list of all static pages on modify product pages so that you can easily select them and associate them.
Use the below SQL in patch/upgrade to add the additional faq field:
Code:
ALTER TABLE `xcart_products` ADD `faq` INT( 11 ) NOT NULL ;
Edit, include/product_modify.php
Code:
#
# Add pages array for dropdown
#
$pages = func_query("SELECT * from `xcart_pages` ORDER BY orderby");
$smarty->assign("pages",$pages);
You'll also need to update the db query so comment out the similar line and add this one instead.
Code:
#
# Find the similar db query and update accordingly
# , faq='$faq'
# is appended to the query
#
db_query("update $sql_tbl[products] set preorder='$preorder', product='$product', categoryid='$categoryid', categoryid1='$categoryid1', categoryid2='$categoryid2', categoryid3='$categoryid3', categoryid4='$categoryid4', categoryid5='$categoryid5', categoryid6='$categoryid6', categoryid7='$categoryid7', categoryid8='$categoryid8', categoryid9='$categoryid9', categoryid10='$categoryid10', brand='$brand', model='$model', keywords='$keywords', descr='$descr', fulldescr='$fulldescr', avail='$avail', list_price='$list_price', weight='$weight', productcode='$productcode', forsale='$forsale', distribution='$distribution', free_shipping='$free_shipping', shipping_freight='$shipping_freight', discount_avail='$discount_avail', min_amount='$min_amount', param00='$param00', param01='$param01', param02='$param02', param03='$param03', param04='$param04', param05='$param05', param06='$param06', param07='$param07', param08='$param08', param09='$param09', param10='$param10', param11='$param11', param12='$param12', param13='$param13', faq='$faq', low_avail_limit='$low_avail_limit', $apply_vat free_tax='$free_tax' $apply_canadian_taxes where productid='$productid'");
Now edit, skin1/main/product_modify.tpl and add:
Code:
#
# Cart-Lab.com FAQ link
#
<TR>
<TD class=ProductDetails>FAQ Page</TD>
<TD class=ProductDetails>
<SELECT name="faq">
<OPTION value=0 {if $product.faq eq "0"}selected{/if}>{$lng.lbl_undefined}</OPTION>
{section name=num loop=$pages}
<OPTION value="{$pages[num].pageid}" {if $pages[num].pageid eq $product.faq}selected{/if}>{ $pages[num].title}</OPTION>
{/section}
</SELECT>
</TD>
</TR>
You'll also need add a link in your product.tpl page that calls the link, like so:
Happy X-Carting!