News:

Looking for documentation? Take a look on our wiki

Main Menu

Choose shipment in popup or modal window

Started by big2000, July 13, 2012, 10:17:32 AM

Previous topic - Next topic

big2000

Hello is there any way to display shipment method in popup or modal window? I was trying:
   echo JHTML::_('link', JRoute::_('index.php?view=cart&task=edit_shipment',$this->useXHTML,$this->useSSL), $this->select_shipment_text,'class="modal"');
but it gives me empty white square. Thx in advance for any directions. 
KrzysztofM
viktoria.com.pl
alelek.pl

big2000

KrzysztofM
viktoria.com.pl
alelek.pl

srajca

I am looking for the same solution however I cannot get it to work. Could you please share how you did this? Thanks a ton.

big2000

OK but its hard and it don't work if you want to do same thing for payment.
1) Make backup of you page plz. Most important step.
2) I'm using plugin modal messeges and in this tutorial I'm using its layout.
3) In my index.php OF MY LAYOUT <-- you can edit it in your template tab in joomla administration
Before closing of head i put code:
<script type="text/javascript">
var now = false;

function show(id, event)
{
hide();
document.getElementById(id).style.display = 'block';
now = id;
event.stopPropagation();
}

var tag;

function hide()
{
  if(now)
  {
  document.getElementById(now).style.display = 'none';
  }
}
</script>

4) In my components/com_virtuemart/views/cart/view.html.php file i copy form   if ($layoutName == 'select_shipment') 
$this->lSelectShipment();

$pathway->addItem(JText::_('COM_VIRTUEMART_CART_OVERVIEW'), JRoute::_('index.php?option=com_virtuemart&view=cart'));
$pathway->addItem(JText::_('COM_VIRTUEMART_CART_SELECTSHIPMENT'));
$document->setTitle(JText::_('COM_VIRTUEMART_CART_SELECTSHIPMENT'));



and paste just above this IF.

<---here
if ($layoutName == 'select_shipment')  {
if (!class_exists('vmPSPlugin')) require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
JPluginHelper::importPlugin('vmshipment');
$this->lSelectShipment();

$pathway->addItem(JText::_('COM_VIRTUEMART_CART_OVERVIEW'), JRoute::_('index.php?option=com_virtuemart&view=cart'));
$pathway->addItem(JText::_('COM_VIRTUEMART_CART_SELECTSHIPMENT'));
$document->setTitle(JText::_('COM_VIRTUEMART_CART_SELECTSHIPMENT'));
} else if ($layoutName == 'select_payment') {

5) In my components/com_virtuemart/views/cart/tmpl/default_pricelist.php. I changed line:    echo JHTML::_('link', JRoute::_('index.php?view=cart&task=edit_shipment',$this->useXHTML,$this->useSSL), $this->select_shipment_text,'class=""');
for

<a href="#null" onclick="show('modal-messages2', event);" class="przyci" > <?php echo $this->select_shipment_text?> </a><?php
                         ?>
<div id="modal-messages2" style="display: none;">
                         <div onclick="hide('modal-messages2', event);" style=" background-color:#000;opacity: 0.65; *background:none; z-index: 1001; top:0px; left:0px; width:100%; height: auto !important; min-height: 100%; position:fixed;"> </div>
                         <div id="smWindow2" class="'.$type.'" onclick="event.stopPropagation();" style=" position: fixed;top: 50%;left: 50%; opacity: 1; z-index: 1002; "  >
<div id="smwin_tl"></div>
<div id="smwin_tm"></div>
<div id="smwin_tr"></div>
<div class="clearfix"></div>
<div id="smwin_ml">
<div id="smwin_mr">
<div id="smWindowContentOuter">
<div id="smWindowContentTop">

<div id="logoContainer">
<div id="smwin_logo"></div>
<div id="smwin_title2"><?php echo JText::_('COM_VIRTUEMART_CART_SELECT_SHIPMENT')?></div>
</div>
<div class="clearfix"></div>
</div>
<div id="smWindowContentWrap">
<div id="smWindowContent">
                               <form method="post" id="userForm" name="chooseShipmentRate" action="<?php echo JRoute::_('index.php'); ?>" class="">
                                <?php

                                 if(
$this->cart->getInCheckOut()){
                                
$buttonclass 'button vm-button-correct';
                                
} else {
                                
$buttonclass 'default';
                                
}

                                    if (
$this->found_shipment_method) {
                                
                                
                                
   echo "<fieldset>\n";
                                
// if only one Shipment , should be checked by default
                                
    foreach ($this->shipments_shipment_rates as $shipment_shipment_rates) {
                                
if (is_array($shipment_shipment_rates)) {
                                
    foreach ($shipment_shipment_rates as $shipment_shipment_rate) {
                                
echo '<div class="labels">';
                                                        echo 
$shipment_shipment_rate."<br />\n";
                                
        echo '</div>';
                                                    }
                                
}
                                
    }
                                
    echo "</fieldset>\n";
                                    } else {
                                
 echo "<h1>".$this->shipment_not_found_text."</h1>";
                                    }

                                    
?>

                                    <div class="buttonBar2">

                                        <button class="<?php echo $buttonclass ?>" type="submit" ><?php echo JText::_('COM_VIRTUEMART_SAVE'); ?></button>  &nbsp;
                                <button class="<?php echo $buttonclass ?>" type="reset" onClick="window.location.href='<?php echo JRoute::_('index.php?option=com_virtuemart&view=cart'); ?>'" ><?php echo JText::_('COM_VIRTUEMART_CANCEL'); ?></button>
                                </div>
                                    <input type="hidden" name="option" value="com_virtuemart" />
                                    <input type="hidden" name="view" value="cart" />
                                    <input type="hidden" name="task" value="setshipment" />
                                    <input type="hidden" name="controller" value="cart" />
                                </form>

                              </div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div id="smwin_bl"></div>
<div id="smwin_bm"></div>
<div id="smwin_br"></div>
<div class="clearfix"></div>
</div>  </div>



                                <?php


6) CSS I wrote. Rest propably is in plugin modalmesseges
#smWindow2{
               background-color:#fff;
               position: fixed;
               top: 50%;
               left: 50%; margin-top: -90px; margin-left: -270px;
               padding-bottom:15px;
               border: 5px solid #b31600;
               width: 500px;
                  -webkit-border-radius: 13px;
     -moz-border-radius: 13px;
         border-radius: 13px;
                      -moz-box-shadow:    inset 0 0 10px #000000;
   -webkit-box-shadow: inset 0 0 10px #000000;
   box-shadow:         inset 0 0 10px #000000;
   z-index: 1001;


}
#smwin_title2{
background-color: #B31600;
    color: #b9298b;
    font-family: BebasNeue,Avenir,Arial,Helvetica,sans-serif;
    font-size: 26px;
    font-weight: 600;
    height: 23px;
    margin-top: 13px;
    overflow-x: hidden;
    overflow-y: hidden;
    padding-top: 2px;
    text-align: center;
    text-transform: uppercase;
    width: 100%;
        margin-bottom: 13px;

}
#smWindowContent{
margin-left:10px;

}
input:checked + label {
float:left;
color: #b9298b;
background-color: #B31600;
box-shadow: 0px 5px 5px #888, 0px -5px 5px #888;


}
.labels{
height:65px;
margin-bottom:20px;
width: 98%;
}

.labels label{
width: 100%;
overflow:hidden;
}
.vmCartPaymentLogo{
  float:left;

}
.labels input{
display: none;
}
.vmpayment_cost,  .vmshipment_cost{
   display:block;
   font-size: 16px;
   margin-left:160px;
   margin-top:-4px;
   }
.vmshipment_name, .vmpayment_name{
display: block;
margin-left:160px;
    font-size: 26px;
    padding-top: 3px;
}
.vmpayment_description,.vmshipment_description {
    display:block;
    margin-left:160px;
    margin-top: 4px;
        margin-bottom: 4px;
}
.vmpayment_cardinfo {color:gray;font-size:9px;}

ITS WORKING ON MY PAGE BUT DON'T HAVE TO ON YOURS. Do it only if you know what you doing. I didn't. xD.
Sorry for my English. 



KrzysztofM
viktoria.com.pl
alelek.pl

big2000

And about my tutorial i cannot make it work for payment becouse of double calling of    $dispatcher = JDispatcher::getInstance();
One is in
private function lSelectShipment() { ...
   $dispatcher = JDispatcher::getInstance();
      $returnValues = $dispatcher->trigger('plgVmDisplayListFEShipment', array( $this->cart, $selectedShipment, &$shipments_shipment_rates));
...}
second is in
private function lSelectPayment() {
...
   $dispatcher = JDispatcher::getInstance();
      $returnValues = $dispatcher->trigger('plgVmDisplayListFEPayment', array($this->cart, $selectedPayment, &$paymentplugins_payments));
...}
when i call it second time shipment and payment stop working. Thx for any clues how to make it work.
KrzysztofM
viktoria.com.pl
alelek.pl

big2000

Ok done shipment and payment in modal.  Thx for all your help :)
KrzysztofM
viktoria.com.pl
alelek.pl

vykupitel

Hi.
Could you please describe here how you fix yours last issues with double calling of $dispatcher = JDispatcher::getInstance() ? Thanks for your help. :-)

artemiy

#7
Quote from: big2000 on July 17, 2012, 13:02:52 PM
Ok done shipment and payment in modal.  Thx for all your help :)

It's very important for me at this moment. Please describe your steps.

mxf

Quote from: artemiy on September 28, 2012, 09:10:34 AM
Quote from: big2000 on July 17, 2012, 13:02:52 PM
Ok done shipment and payment in modal.  Thx for all your help :)

It's very important for me at this moment. Please describe your steps.

Someone could help with this?
Preaty please :)