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, 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

Magento Forum

I need to create a module for customer who bought this also bought this
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

//$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."'");
$order=mysql_query("select distinct order_id from sales_flat_order_item where product_id='" .$proId. "'");
//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());
//echo $aa_data['product_id'].'<br />';
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 ?>
for($_i=0;$_i<4;$_i++): ?>
//echo $bc[$_i];
$pUrl=mysql_query("select request_path from core_url_rewrite where product_id='" .$bc[$_i]. "'");
$pUrl_data = mysql_fetch_array($pUrl);
<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) ?>

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

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