I got a custom component which is actually an ajax search form. Someone select some options and when he hit submit button i want to load some products based on the selected criteria.
I includes the js / css
snipcart files needed inside my template's index.php
file and when I use the JS validation on snipcart's dashboard it says everything is ok.
Reading the Snipcart's Doc i have to add the data-item-url
for each product.
I started by setting : data-item-url="http://mydomain.com/components/com_rouf/scripts/ajaxProducts.php"
( this was the file that was performing the ajax call and printing the products )
When I tried to buy a product, on checkout tab I get this error:
Item B1-TEST has not been found at http://mydomain.com/components/com_rouf/scripts/ajaxProducts.php.
Then i changed it to : data-item-url="http://mydomain.com/index.php?option=com_rouf"
(the view file in which the html code was printed)
No result.
After that i moved the ajax file
mechanism inside a new view file
and instead of ajax call
i used a form
to send the search options.
tried both data-item-url="http://mydomain.com/index.php?option=com_rouf&view=rouf&layout=products.php"
AND
data-item-url="http://mydomain.com/components/com_rouf/views/rouf/tmpl/products.php"
Same Error.
After that i thought that for actually printing the html code of product so snipcart can crawl and find it in both the view and ajax file a $_POST
is mandatory.
So i created a new file test.php
printing ALL products.Ofc this is a retarded way and it is only for test purposes.
<?php
$db=JFactory::getDbo();
$query='SELECT * from `#__dash_sxoles_pricing` as a left join `#__dash_license_cat` as b on a.license_id=b.id left join `#__dash_sxoles` as c on a.sch_id = c.id where 1';
$db->setQuery($query);
$res=$db->loadObjectList();
foreach ($res as $row ) {
$diplCode=$row->code.'-'.$row->name;
echo '
<div>'.$row->company.'</div>
<button type="button" class="snipcart-add-item"
data-item-name="'.$diplCode.'"
data-item-price="'.$row->price.'"
data-item-id="'.$row->id.'-'.$row->license_id.'"
data-item-url="http://mydomain.com/test.php">
Add to cart
</button>
</div>
';
}
?>
Didnt work either. I allready sent an email @ snipcart but I didnt have a response.
Has anyone set snipcart before in Joomla! ? Am I completly missing something here or ?