Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

I need to create a module for customer who bought this also bought this
 
maddyphp
Jr. Member
 
Total Posts:  2
Joined:  2009-06-05
 

I have just created the normal php query but i do not know how to call the images while displaying
i used something like this

<?php
include('includes/configure.php');
//$currentFile = $_SERVER["PHP_SELF"];
//$parts = Explode('/', $currentFile);
//$pageName = $parts[count($parts) - 1];
//$page = mysql_query("select product_id from core_url_rewrite where request_path like '%".$pageName."'");
//$page_data=mysql_fetch_array($page);
//if($page_data['product_id']!='')
//{
$bc=array();
$order=mysql_query("select distinct order_id from sales_flat_order_item where product_id='" .$proId. "'");
while($order_data=mysql_fetch_array($order))
{
//echo "select distinct product_id from sales_flat_order_item where product_id<>'167' AND order_id='" .$order_data['order_id']. "'";
$aa=mysql_query("select product_id from sales_flat_order_item where product_id<>'" .$proId. "' AND order_id='" .$order_data['order_id']. "'") or die(mysql_error());
while($aa_data=mysql_fetch_array($aa))
{
//echo $aa_data['product_id'].'<br />';
if(!in_array($aa_data['product_id'],$bc))
{
$bc[]=$aa_data['product_id'];
}
}
}
//print_r($bc);
$_cnt=count($bc);
//}
if($_cnt > 0)
{
?>
<div class="collateral-box up-sell">
<div class="head"><h4><?php echo $this->__('Customer who bought this also bought this also bought this') ?></h4></div>
<table cellspacing="0" class="generic-product-grid catalog-listing” id="upsell-product-table">
<?php // $this->setColumnCount(4); // uncomment this line if you want to have another number of columns. also can be changed in layout ?>
<tr>
<?php
for($_i=0;$_i<4;$_i++): ?>
<?php
//echo $bc[$_i];
$pUrl=mysql_query("select request_path from core_url_rewrite where product_id='" .$bc[$_i]. "'");
$pUrl_data = mysql_fetch_array($pUrl);
?>
<td>
<p class="product-image"><a href="<?php echo $pUrl_data['request_path']; ?>"><img src="media\catalog\product<?php //echo $this->helper('catalog/image')->init($_link, 'small_image')->resize(125) ?>” width="125" height="125" alt="<?php //echo $this->htmlEscape($_link->getName()) ?>” /></a></p>
<h5><a href="<?php //echo $_link->getProductUrl() ?>"><?php //echo $this->htmlEscape($_link->getName()) ?></a></h5>
<?php //echo $this->getPriceHtml($_link, true) ?>
<?php //echo $this->getReviewsSummaryHtml($_link) ?>
</td>

<?php endfor; ?>
</tr>
<?php //endfor; ?>
</table>
<script type="text/javascript\">decorateTable(’upsell-product-table’)</script>
</div>
<?php
}
?>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top