News:

Support the VirtueMart project and become a member

Main Menu

Category Page Fields for Templating

Started by PRO, February 08, 2012, 19:42:18 PM

Previous topic - Next topic

PRO

Quote from: amanda mc donald on March 11, 2012, 20:34:13 PM
I want to link an image to a URL on the internet (e.g. a specific youtube video)

You are going to have to save the url in one of the "other fields", and use that variable in the url creation.


corymp

How can I display a product's custom field on the category page. So far I have:


<?php
if (!empty($product->customfieldsSorted['myposition'])) { 
       foreach (
$product->customfieldsSorted['myposition'] as $field) {
if ($field->display) {
if ($field->custom_title != $custom_title) { 
echo $field->display;
}

?>

VM 2.0.4 Stable
J2.5.4

corymp

No response on this? it's not possible?
VM 2.0.4 Stable
J2.5.4

hollywooood

Essentially, I have my category, productdetails and categories folders in the com_virtuemart, html folder.  The product details page works, the categories page works but the category page is non functional.  I have read and re-read this post 5 or 6 times, copied and pasted the coding (which is still the same as what I have) but all this has been done in vain. 

This all started when i made the migration from VM2.0 to VM2.0.2...  My head is really spinning here and all the numbers and letters are starting to merge together and NO, I am not on drugs.

Here is my product coding from the category page:
// Show Products ?>
<div class="product floatleft<?php echo $Browsecellwidth $show_vertical_separator ?>">
<div class="spacer">
<div class="floatleft center width140">
               
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>



<!-- The "Average Customer Rating" Part -->
<?php if (VmConfig::get('pshop_allow_reviews') == 1) { ?>
<span class="contentpagetitle"><?php echo JText::_('COM_VIRTUEMART_CUSTOMER_RATING'?>:</span>
<br />
<?php
// $img_url = JURI::root().VmConfig::get('assets_general_path').'/reviews/'.$product->votes->rating.'.gif';
// echo JHTML::image($img_url, $product->votes->rating.' '.JText::_('COM_VIRTUEMART_REVIEW_STARS'));
// echo JText::_('COM_VIRTUEMART_TOTAL_VOTES').": ". $product->votes->allvotes; ?>

<?php ?>
<div id="productname-box">
                    <br/>
<h2><?php echo JHTML::link($product->link$product->product_name); ?></h2>

<?php // Product Short Description
if(!empty($product->product_s_desc)) { ?>

<p class="product_s_desc">
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc40'...'?>
</p>
<?php ?>

<div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php
if ($this->show_prices == '1') {
if( $product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
echo "<strong>"JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
}

//todo add config settings
if( $this->showBasePrice){
echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
echo $this->currency->createPriceDiv('basePriceVariant','COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT',$product->prices);
}
echo $this->currency->createPriceDiv('variantModification','COM_VIRTUEMART_PRODUCT_VARIANT_MOD',$product->prices);
echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
echo $this->currency->createPriceDiv('discountedPriceWithoutTax','COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE',$product->prices);
echo $this->currency->createPriceDiv('salesPriceWithDiscount','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT',$product->prices);
echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
echo $this->currency->createPriceDiv('priceWithoutTax','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX',$product->prices);
echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices);
echo $this->currency->createPriceDiv('taxAmount','COM_VIRTUEMART_PRODUCT_TAX_AMOUNT',$product->prices);
?>

</div>
                    <br/>
<p class="prodetails-button">
<?php // Product Details Button
echo JHTML::link($product->linkJText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));
?>

</p>

</div>


The proper number of products is being shown on the page but no images or product names and the links are not going anywhere. 

I really really really appreciate any insight on this.  Also please note that I have search everywhere for this but as I said I am a bit head spun.
Joomla 2.5.4
Virtuemart 2.0.6
PHP 5.2.17
MySQL 5.5.21-55
APACHE 2.2.22

PRO

hollywooood, I am not going to read that code and look for a problem.

Are all images published in the "shop media files"?

AND: what happens when you take a clean category default.php, and put it in the template override folder?




corymp

Banquet, Is there a way yet to put custom fields from the product onto the category page?
VM 2.0.4 Stable
J2.5.4

hollywooood

#21
Hi Banquet...thanks for the reply.  All images are published in "Shop Media" and just to be sure I popped in a clean default, again, and still having the issue.  I just noticed there are spaces in the image name, would this be a problem?  I didn't think anything of this since the images show everywhere else..

also, none of the product names are showing..
Joomla 2.5.4
Virtuemart 2.0.6
PHP 5.2.17
MySQL 5.5.21-55
APACHE 2.2.22

PRO

Quote from: hollywooood on March 21, 2012, 11:38:24 AM
Hi Banquet...thanks for the reply.  All images are published in "Shop Media" and just to be sure I popped in a clean default, again, and still having the issue.  I just noticed there are spaces in the image name, would this be a problem?  I didn't think anything of this since the images show everywhere else..

also, none of the product names are showing..

have you tried the tool "install or update tables if necessary"


PRO

Quote from: corymp on March 21, 2012, 11:31:10 AM
Banquet, Is there a way yet to put custom fields from the product onto the category page?

what custom field?

corymp

#24
If I create a custom field and place it on the product page, say Warranty. Set it to position "Waranty". Can I take that same custom field and put it on the category page for that product?
So far I have this to place a custom positioned string on my product page

<?php
if (!empty($this->product->customfieldsSorted['myposition'])) { 
       foreach (
$product->customfieldsSorted['myposition'] as $field) {
if ($field->display) {
if ($field->custom_title != $custom_title) { 
echo $field->display;
}

?>


I want to place the same custom field on the category page for the product
VM 2.0.4 Stable
J2.5.4

hollywooood

Just tried this and no luck... :o  ...any other ideas?
Joomla 2.5.4
Virtuemart 2.0.6
PHP 5.2.17
MySQL 5.5.21-55
APACHE 2.2.22

PRO

Quote from: corymp on March 21, 2012, 11:49:36 AM
If I create a custom field and place it on the product page, say Warranty. Set it to position "Waranty". Can I take that same custom field and put it on the category page for that product?
So far I have this to place a custom positioned string on my product page

<?php
if (!empty($this->product->customfieldsSorted['myposition'])) { 
       foreach (
$product->customfieldsSorted['myposition'] as $field) {
if ($field->display) {
if ($field->custom_title != $custom_title) { 
echo $field->display;
}

?>


I want to place the same custom field on the category page for the product

this wont work in category. It would take some custom coding.




hollywooood

What more information can I provide to sort out why my product data (image and product name) isn't displaying on my category page?  Any other ideas or suggestions other than the obvious on this one?  I greatly appreciate a solution on this....

Thanks in advance for any help..
Joomla 2.5.4
Virtuemart 2.0.6
PHP 5.2.17
MySQL 5.5.21-55
APACHE 2.2.22

hollywooood

I just reset all tables and installed sample data from the tools menu and still this issue occurs...Writing this off as a bug since i am unable to resolve here...appreciate all the help...
Joomla 2.5.4
Virtuemart 2.0.6
PHP 5.2.17
MySQL 5.5.21-55
APACHE 2.2.22

hollywooood

My issue has been resolved...turns out, virtuemart does not like Falang as a translating option.  How in the heck does one figure these things out?  Turn off every plugin one by one until things start working again.  Painful process but learned a great deal...

Joomla 2.5.4
Virtuemart 2.0.6
PHP 5.2.17
MySQL 5.5.21-55
APACHE 2.2.22