VirtueMart Dev/Coding Central: VM1 (old version) > Development Projects, Modifications, Hacks & Tweaks. VM1.1

Add manufacturer logo in browse & flypage

<< < (2/4) > >>

ruben-sp:

--- Quote ---I'm not sure it will be compatible with the newer version I've got.
--- End quote ---

i havent tried it yet but i'll do in a couple of weeks as im working in a new project and im suppose to include logos manufacturer in every product.

ruben-sp:
Updated and working with J 1.5.22 and VM 1.1.8

FilipeRuivo:
Here is a simple way to do it, no need to edit all this files.

In the administrator/components/com_virtuemart/html/shop.browse.php
find
--- Code: ---// i is the index for the array holding all products, we need to show. to allow sorting by discounted price,
// we need to use the price as first part of the index name!
$i = $product_price_raw['product_price'] . '_' . ++$counter;
--- End code ---

add after around line 328

--- Code: ---$products[$i]['product_id'] = $db_browse->f('product_id'); // add $product_id to browse page
--- End code ---
      



In the /components/com_virtuemart/themes/yourtemplate/theme.php add this right after // Your code here please...


--- Code: ---function get_mdetails($product_id, $var) {
$db = new ps_DB;

$q = "SELECT * FROM #__{vm}_product_mf_xref,#__{vm}_manufacturer ";
$q .= "WHERE product_id='$product_id' ";
$q .= "AND #__{vm}_manufacturer.manufacturer_id=#__{vm}_product_mf_xref.manufacturer_id";

$db->query($q);
$db->next_record();
$html = $db->f($var);
return $html;
}
--- End code ---

Now you can get the manufacturer details any here in your template

just type:

echo $this->get_mdetails( $product_id, 'manufacturer_id' );
echo $this->get_mdetails( $product_id, 'mf_name' );
echo $this->get_mdetails( $product_id, 'mf_desc' );
echo $this->get_mdetails( $product_id, 'mf_email' );
echo $this->get_mdetails( $product_id, 'mf_url' );


That's it ;)

ruben-sp:

--- Quote from: FilipeRuivo on December 16, 2011, 23:40:11 PM ---Here is a simple way to do it, no need to edit all this files and no core hack.

In the /components/com_virtuemart/themes/yourtemplate/theme.php add this right after // Your code here please...


--- Code: ---function get_mdetails($product_id, $var) {
$db = new ps_DB;

$q = "SELECT * FROM #__{vm}_product_mf_xref,#__{vm}_manufacturer ";
$q .= "WHERE product_id='$product_id' ";
$q .= "AND #__{vm}_manufacturer.manufacturer_id=#__{vm}_product_mf_xref.manufacturer_id";

$db->query($q);
$db->next_record();
$html = $db->f($var);
return $html;
}
--- End code ---

Now you can get the manufacturer details any here in your template

just type:

echo $this->get_mdetails( $product_id, 'manufacturer_id' );
echo $this->get_mdetails( $product_id, 'mf_name' );
echo $this->get_mdetails( $product_id, 'mf_desc' );
echo $this->get_mdetails( $product_id, 'mf_email' );
echo $this->get_mdetails( $product_id, 'mf_url' );


That's it ;)

--- End quote ---

thanks for your contribution! that's a very easy wat to get it.  it works fine for flypage but  unfortunately it does not work for browse pages :(, it shows all products with the information regarded to the last product's manufacturer

FilipeRuivo:

--- Quote from: ruben-sp on December 17, 2011, 15:36:28 PM ---
--- Quote from: FilipeRuivo on December 16, 2011, 23:40:11 PM ---Here is a simple way to do it, no need to edit all this files and no core hack.

In the /components/com_virtuemart/themes/yourtemplate/theme.php add this right after // Your code here please...


--- Code: ---function get_mdetails($product_id, $var) {
$db = new ps_DB;

$q = "SELECT * FROM #__{vm}_product_mf_xref,#__{vm}_manufacturer ";
$q .= "WHERE product_id='$product_id' ";
$q .= "AND #__{vm}_manufacturer.manufacturer_id=#__{vm}_product_mf_xref.manufacturer_id";

$db->query($q);
$db->next_record();
$html = $db->f($var);
return $html;
}
--- End code ---

Now you can get the manufacturer details any here in your template

just type:

echo $this->get_mdetails( $product_id, 'manufacturer_id' );
echo $this->get_mdetails( $product_id, 'mf_name' );
echo $this->get_mdetails( $product_id, 'mf_desc' );
echo $this->get_mdetails( $product_id, 'mf_email' );
echo $this->get_mdetails( $product_id, 'mf_url' );


That's it ;)

--- End quote ---

thanks for your contribution! that's a very easy wat to get it.  it works fine for flypage but  unfortunately it does not work for browse pages :(, it shows all products with the information regarded to the last product's manufacturer


--- End quote ---

My bad I forget to add a product_id into the browse page.

I have already corrected my solution in the previous post

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version