Author Topic: Dynamic cart logo/graphic change. Some help needed.  (Read 3565 times)

a_smith

  • Beginner
  • *
  • Posts: 1
Dynamic cart logo/graphic change. Some help needed.
« on: January 19, 2010, 12:02:36 pm »
(hope its right place to post my problem)


Hi
Its my first post here so a worm HI to all of you VM lovers :-).

I am asking some help with PHP coding.
Have stacked with my 'dynamic cart image/logo change' mod.

I use SHOPPER_FRENZY Joomla+VM template pack
http://www.shape5.com/demo/shopper_frenzy/. (Have a play with the demo to see how its look when you add something to the cart).

The 'front-end' cart module is S5 Drop Down Cart http://www.shape5.com/product_details/club_extensions/s5_drop_down_cart.html


I am trying to mod the cart module to have something like 'dynamic cart logo'.
When there is no products added to the cart I want to see background.png.
When there is something in the cart I want to cart logo to be changed to background-cartfull.png.
I don't mind if the logo changed would be organised using PHP, CSS, AJAX or whotever.
Final effect needs be same as here http://www.ptemplates.com/demos/ccv4c/index.php ( This one is lovely CubeCart template but please add something to the cart to see what I mean about cart logo change).

DIV where the cart logo is placed is defined in Joomla template_css.css:

Code: [Select]
div.vmCartModule hr {
margin-bottom:1px;
margin-top:60px;
color:#EBEBEB;
}


This DIV position, size, font etc can be set up via Joomla module back-end. The code which read those parameters look like this:
/modules/mod_virtuemart_s5_dropdown_cart/mod_virtuemart_s5_dropdown_cart.php

Code: [Select]
<div class="vmCartModule" id="vmCartModule" style="margin-bottom:<?php echo $bmargin ?>px;margin-top:<?php echo $tmargin ?>px;margin-right:<?php echo $rmargin ?>px;margin-left:<?php echo $lmargin ?>px;background:url(<?php echo $LiveSite ?>modules/mod_virtuemart_s5_dropdown_cart/s5_dropdown/background.png) no-repeat top right; position:relative;width:<?php echo $_SESSION['width'?>px;height:<?php echo $_SESSION['height'?>px">
<script type="text/javascript">//<![CDATA[




The code which display all on the screen looks like this:
/modules/mod_virtuemart_s5_dropdown_cart/minicart.tpl.php

Code: [Select]
<?php if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
global 
$vmMinicart;
$LiveSite JURI::base();
?>


<script type="text/javascript">var live_site="<?php echo $LiveSite ?>"</script>

<?php 
if ($cart["idx"] == 0) { 
echo "

<div id=\"s5_dropdownback\">
<div>
<div style='color:#"
.$_SESSION['fontcolor'] ."; float:right; margin-right:25px; margin-top:19px; line-height:14px; font-size:".$_SESSION['fontsize'] ."px'>
"
$amount " szt
</div>

<div style=\"clear:both\"></div>

<div style='color:#"
.$_SESSION['fontcolor'] .";float:right; margin-right:10px; margin-top:12px;font-size:".$_SESSION['fontsize'] ."px'>
"
.$_SESSION['order_totall']. " "$CURRENCY_DISPLAY->getFullValue($total) ."
</div>

</div>

</div>

<div id=\"s5_dropdowncart\" style='background:#"
$_SESSION['backcolor']. ";display:"$_SESSION['openclose_display']. ";position:absolute;z-index:2;float:left;overflow:hidden;width:242px;margin:0 auto;margin-top:10px;border-bottom:1px solid #333333;border-left:1px solid #333333;border-right:1px solid #333333;color:#".$_SESSION['backfontcolor'].";'>

<div style=\"padding:6px;\">
<script type=\"text/javascript\" src=\""
.$LiveSite."modules/mod_virtuemart_s5_dropdown_cart/s5_dropdown/s5_dropdown.js\"></script>
<div id=\"vmCartModule2\" style=\"position:relative\">

"
;
}
else {

echo "

<div id=\"s5_dropdownback\">

<div>
<div onclick=\"s5_tab_dd();shiftOpacity_dd('s5_dropdowncart');\" style='font-weight:bold;cursor:pointer;color:#"
.$_SESSION['fontcolor'] ."'>
<div id=\"s5_open_dd\" style=\"display:none;float:left; padding-right:23px; margin-top:18px;background:url("
.$LiveSite."modules/mod_virtuemart_s5_dropdown_cart/s5_dropdown/arrow.png) no-repeat center right; margin-top:18px; font-size:".$_SESSION['fontsize'] ."px\">
"
.$_SESSION['button2text']."
</div>
<div id=\"s5_closed_dd\" style=\"display:none;float:left; padding-right:23px; margin-top:18px;background:url("
.$LiveSite."modules/mod_virtuemart_s5_dropdown_cart/s5_dropdown/arrow.png) no-repeat center right; margin-top:18px; font-size:".$_SESSION['fontsize'] ."px\">
"
$_SESSION['button2textclicked'] ."
</div>
</div>

<div style='color:#"
.$_SESSION['fontcolor'] ."; float:right; margin-right:25px; margin-top:18px; font-size:".$_SESSION['fontsize'] ."px'>
"
$amount " szt  </div>


</div>

<div style=\"clear:both\"></div>

<div>

<div onclick=\"window.document.location.href='" 
.$sess->url($mm_action_url."index.php?page=shop.cart")."'\" style='font-weight:bold; cursor:pointer;color:#".$_SESSION['fontcolor'] .";float:left;padding-right:23px; margin-top:10px; background:url(".$LiveSite."modules/mod_virtuemart_s5_dropdown_cart/s5_dropdown/arrow.png) no-repeat center right;margin-top:10px; font-size:".$_SESSION['fontsize'] ."px'>
"
$_SESSION['button1text'] ." </div>


<div style='color:#"
.$_SESSION['fontcolor'] .";float:right; margin-right:10px; margin-top:11px;font-size:".$_SESSION['fontsize'] ."px'>
 "
$CURRENCY_DISPLAY->getFullValue($total) ." </div>

</div>

<div style=\"clear:both\"></div>

</div>

<div style=\"clear:both\"></div>

<div id=\"s5_dropdowncart\" style='background-color:#"
$_SESSION['backcolor']. ";display:"$_SESSION['openclose_display']. ";position:absolute;z-index:2;float:left;overflow:hidden;width:"$_SESSION['width']. "px;margin:0 auto;margin-top:10px;border:1px solid #"$_SESSION['bordercolor']. ";color:#".$_SESSION['backfontcolor'].";'>

<div style=\"padding:12px;\">
<script type=\"text/javascript\" src=\""
.$LiveSite."modules/mod_virtuemart_s5_dropdown_cart/s5_dropdown/s5_dropdown.js\"></script>
<div id=\"vmCartModule2\" style=\"position:relative;font-size:"
.$_SESSION['fontsize'] ."px\">

"
;
}
?>


This how its look at the moment:
- no products in the cart:


- something in the cart :

Here is when I want to have cart graphics changed to the other one to make it work same way as here http://www.ptemplates.com/demos/ccv4c/index.php (add something to the cart please to see what I mean).

I have tried to make it working but as I am not a coder I've stacked and it won't work.
Can someone help me to solve the problem and to have cart graphic changed to the other one when some products has been added?
Obvious think is that when all items will be deleted from the cart, the cart image needs be changed back to the original one.


Thanks a lot for looking.


VirtueMart Forum

Dynamic cart logo/graphic change. Some help needed.
« on: January 19, 2010, 12:02:36 pm »