You are here:  » show producst and category


show producst and category

Submitted by daisan on Sat, 2014-12-27 04:54 in

hi, i was installed site and imported feed manager xml file , so i can not add products and make category. when i click category mapping for creating then i check it but i don't see it about front end. problem as add product . can you help me ???

my xml file

<?xml version="1.0" encoding="UTF-8" ?>
<products>
  <product>
    <merchant_sku>ART002</merchant_sku>
    <product_name>demo-1</product_name>
    <product_description>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</product_description>
    <manufacturer>Inax</manufacturer>
    <Current_Price>45.00</Current_Price>
    <Original_Price>0.00</Original_Price>
    <price>45.00</price>
    <stock>Y</stock>
    <Product_URL>{link saved}</Product_URL>
    <Image_URL>{link saved}</Image_URL>
    <Product_Type>Gạch INAX HAL-20B/GRM 1</Product_Type>
    <Condition>Mới</Condition>
  </product>
  <product>
    <merchant_sku>HAL-20B/GRM 1</merchant_sku>
    <product_name>Gạch INAX HAL-20B/GRM 1</product_name>
    <product_description>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</product_description>
    <manufacturer>Diesel</manufacturer>
    <Current_Price>85.99</Current_Price>
    <Original_Price>0.00</Original_Price>
    <price>85.99</price>
    <stock>Y</stock>
    <Product_URL>{link saved}</Product_URL>
    <Image_URL>{link saved}</Image_URL>
    <Product_Type>xxxxx</Product_Type>
    <Condition>Mới</Condition>
  </product>
</products>

Submitted by support on Sat, 2014-12-27 11:42

Hello daisan and welcome to the forum!

To show the category on the product page, you can use this code anywhere in your html/product.php file:

Category: <?php print $products["products"][0]["category"?>

Hope this helps! Apologies if mis-understood, if you're still not sure of course just let me know!

Cheers,
David.
--
PriceTapestry.com

Submitted by LeadFoot on Fri, 2015-07-10 19:42

I couldn't get this to work, however I did find inspiration here:
http://www.pricetapestry.com/node/5621

This ultimately worked for me to list the category on my product page.

<p>Category:
<?php
$categoryHierarchy = tapestry_categoryHierarchy();
if ($config_useRewrite){
        $href = $config_baseHREF."category/".urlencode(tapestry_hyphenate($categoryHierarchy[$product_main["categoryid"]]["path"]))."/";
    }else{
        $href = $config_baseHREF."search.php?q=category:".urlencode($product_main["categoryid"]).":";
    }
    print "<a href='".$href."'>".$categoryHierarchy[$product_main["categoryid"]]["path"]."</a></li>";
?>
</p>

Submitted by support on Sat, 2015-07-11 09:44

Hello Leadfoot,

Code is fine, something to bear in mind for the future if you upgrade to 15/09A is that the tapestry_categoryHierarchy() has been superseded as part of the re-implementation. Similar code for use post-upgrade would be;

<?php
if ($product_main["categoryid"])
{
  
$c tapestry_categoryHierarchyArray(array($product_main["categoryid"]));
  
$href tapestry_indexHREF("category",$c[$product_main["categoryid"]]);
  print 
"<p>Category: <a href='".$href."'>".$c[$product_main["categoryid"]]."</a></p>";
}
?>

(the tapestry_indexHREF() function is current as of 15/01A)

Cheers,
David.
--
PriceTapestry.com