开发者

Display only price of Custom Attribute of a product in Virtuemart

I am creating a mobile phone repairs site for a client and just wanted to ask if anyone knew how to display the price only of a Attribute set on a product. For example:

I have an iPhone, there can be 3 repairs, screen, power and misc. Each with it's own price.

I have 3 hidden div containers that show when the user hovers over specific points on the image of the product. These div containers also contain a "Add To Cart" button. I would like the price of the repair to be displayed below it. ( The prices are defined in the Attributes set for each product. )

I did use, $("vmCartAttributes).hide() to hide all of the custom attributes off the page, now I only want to show the price. So like, hover over the screen, show screen div and display the price associated with that attribute and imagemap point.

I hope this is clear enough.

Will post code if you need it.

Thankyou in advance,

Ross.

<div id="prodtitle">
<?php echo $product_name, $edit_link ?>
<p>Please hover over the image to see repairs.</p>
</div>

<br style="clear:both;" />
<table border="0" style="width: 100%;">
 <tbody>
<tr>
    <?php  if( $this->get_cfg('showManufacturerLink') ) { $rowspan = 5; } else {   $rowspan =     4; } ?>
 <td width="33%" rowspan="<?php echo $rowspan; ?>" valign="top"><br/>
 </table>

 <div id="detailwrap" style="text-align:center;">

<img class="prodimage" name="<?php echo $product_full_image ?>"    src="components/com_virtuemart/shop_image/product/<?php echo $product_full_image ?>" id="<?php echo $product_full_image ?>" usemap="<?php echo $product_full_image ?>" alt=""/>

<div id="detail">
<?php echo $product_description ?>

<div class="screen"><strong>Screen</strong>

<br/>Broke your screen?
<br/>We can fix that.

<form action="<?php echo $mm_action_url ?>index.php" method="post" name="addtocart" id="addtocart<?php echo $i ?>" class="addtocart_form" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) && !$notify ) { echo 'onsubmit="handleAddToCart( this.id );return false;"'; } ?>>
<div class="vmCartDetails"><input name="product_id" value="<?php echo $product_id ?>" type="hidden" />

    <input id="quantity<?php echo $product_id ?>" name="quantity[]" value="1" type="hidden" /> 
    <input class="addtocart_button" value="Add to cart" title="Add to cart" type="submit" />
    <input name="flypage" value="shop.flypage.tpl" type="hidden" /> 
    <input name="page" value="shop.cart" type="hidden" /> 
    <input name="manufacturer_id" value="1" type="hidden" /> 
    <input name="category_id" value="<?php echo  @$_REQUEST['category_id'] ?>" type="hidden" /> 
    <input name="func" value="cartAdd" type="hidden" /> 
    <input name="option" value="com_virtuemart" type="hidden" /> 
    <input name="Itemid" value="1" type="hidden" /> 
    <input name="set_price[]" type="hidden" /> 
    <input name="adjust_price[]" type="hidden" /> 
    <input name="master_product[]" type="hidden" />
    <input name="Repairs<?php echo $product_id ?>" id="Repairs_field" value="Screen" type="hidden" />
    <!--<input type="hidden" name="custom_attribute_fields[]" value="Screen<?php echo $product_id ?>" />-->
</form>
</div>
</div>

<div class="power"><strong>Power</strong>

<br/>Phone not turning on?
<br/>We can fix that.

<form action="<?php echo $mm_action_url ?>index.php" method="post" name="addtocart" id="addtocart<?php echo $i ?>" class="addtocart_form" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) && !$notify ) { echo 'onsubmit="handleAddToCart( this.id );return false;"'; } ?>>
<div class="vmCartDetails"><input name="product_id" value="<?php echo $product_id ?>" type="hidden" />

    <input id="quantity<?php echo $product_id ?>" name="quantity[]" value="1" type="hidden" /> 
    <input class="addtocart_button" value="Add to cart" title="Add to cart" type="submit" />
    <input name="flypage" value="shop.flypage.tpl" type="hidden" /> 
    <input name="page" value="shop.cart" type="hidden" /> 
    <input name="manufacturer_id" value="1" type="hidden" /> 
    <input name="category_id" value="<?php echo  @$_REQUEST['category_id'] ?>" type="hidden" /> 
    <input name="func" value="cartAdd" type="hidden" /> 
    <input name="option" value="com_virtuemart" type="hidden" /> 
    <input name="Itemid" value="1" type="hidden" /> 
    <input name="set_price[]" type="hidden" /> 
    <input name="adjust_price[]" type="hidden" /> 
    <input name="master_product[]" type="hidden" />
    <input name="Repairs<?php echo $product_id ?>" id="Repairs_field" value="Power" type="hidden" />
    <!--<input type="hidden" name="custom_attribute_fields[]" value="Power<?php echo $product_id ?>" />-->
</form>
</div>
</div>

    <!-- Not Implemented Yet -->
<div class="batte开发者_JS百科ry">Battery</div>
<div class="case">Case</div>
<div class="misc">Misc</div>




</div>

    </div>


Well first of all, before I do anything, is tell you that this isn't a php question, this is a jquery question. Second of all, I wouldn't make those buttons those way as the customer might not find the buttons at all! Also, what does $("vmCartAttributes) mean? First of all, no closing quotes, but I'll accept that, but also no definition of is it a Id, or class, or something, and I'm pretty sure there is no such html tag called vmCartAttributes, so i'm going to downvote this question for bad code, also incorrect tagging. However, I will do my best to help you, but I won't do anything about the html tag problem, because if it works for you, then it should work again, though I don't know why it would, also I need the element which will contain the price, and the actual tag which contains the price. Try using the following jquery code:

$("vmCartAttributes").mouseover(function(){
var price=$(this).attr('priceattribute');
$("pricecontainer").text(price);
}).mouseout(function(){
$("pricecontainer").text("");
});

Replace pricecontainer with the element that will show the price and priceattribute with the attribute that contains the price.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜