仅显示 Virtuemart 中产品的自定义属性的价格
我正在为客户创建一个手机维修网站,只是想询问是否有人知道如何仅显示产品上设置的属性的价格。例如:
我有一部 iPhone,可以有 3 项维修,屏幕、电源和杂项。每个都有自己的价格。
我有 3 个隐藏的 div 容器,当用户将鼠标悬停在产品图像上的特定点上时显示。这些 div 容器还包含“添加到购物车”按钮。我希望维修价格显示在其下方。 (价格在每个产品的属性集中定义。)
我确实使用 $("vmCartAttributes).hide() 隐藏页面外的所有自定义属性,现在我只想显示价格。所以像,将鼠标悬停在屏幕上,显示屏幕 div 并显示与该属性和图像地图点相关的价格,
如果您需要的话,
发布代码
我会提前
。
<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="battery">Battery</div>
<div class="case">Case</div>
<div class="misc">Misc</div>
</div>
</div>
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="battery">Battery</div>
<div class="case">Case</div>
<div class="misc">Misc</div>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,在我做任何事情之前,告诉你这不是一个 php 问题,这是一个 jquery 问题。其次,我不会那样制作这些按钮,因为客户可能根本找不到这些按钮!另外,
$("vmCartAttributes)
是什么意思?首先,没有结束引号,但我会接受这一点,但也没有定义它是 Id、类还是其他东西,并且我很确定没有这样的 html 标签,名为 vmCartAttributes,所以我将因为代码错误和标签不正确而否决这个问题,但是,我会尽力帮助您,但是。我不会做任何事关于 html 标签问题,因为如果它对你有用,那么它应该再次工作,尽管我不知道为什么会这样,我还需要包含价格的元素,以及包含价格的实际标签。使用以下 jquery 代码:将 pricecontainer 替换为将显示价格的元素,并将 priceattribute 替换为包含价格的属性。
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:Replace pricecontainer with the element that will show the price and priceattribute with the attribute that contains the price.