The customer needed a popup basket on his site.
Googling, we did not find any ready-made solution or at least a description of such a thing under Ubercart.
I had to do it myself from what is already invented.
The modules
uc ajax cart were used to add a dynamic basket,
colorbox for popup windows,
uc js cart for dynamic goods counting, and tpl and css are also slightly doped.
So the first is uc ajax cart. It has a folder with templates, a little .tpl rule for the implementation of the appearance and some functionality.
Here we will add a hidden div with the contents of the basket and a colorbox link to display this content in the popup window.
I have it like this:
<a href="?width=850&height=auto&inline=true#cartOpen" class="colorbox-inline"> <? $a = count(uc_cart_get_contents()); echo $a.' '.numberProduct($a, array('','','')); ?> </a> <div class="price-of-cart"> <strong><?php print $total ;?></strong></div> <div id="myCart" style="display:none;"> <div id="cartOpen"> <h2 class="cart_header"></h2> <?php print ubercart_popup(); ?> </div> </div>
In appearance:

There is also a function for declining
goods ,
goods ,
goods are:
function numberProduct($number, $titles) { $cases = array (2, 0, 1, 1, 1, 2); return $titles[ ($number%100>4 && $number%100<20)? 2 : $cases[min($number%10, 5)] ]; }
Further, as you saw in the template, there is an output of the contents of the basket.
<?php print ubercart_popup(); ?>
This is the function that rips out the contents of the basket. You need to write it in template.php
It looks like this:
function ubercart_popup() { if (module_exists('uc_cart')) { $items = uc_cart_get_contents(); if (empty($items)) { return theme('uc_empty_cart'); } $output = ''; foreach (uc_cart_cart_pane_list($items) as $pane) { if ($pane['enabled']) { $output .= $pane['body']; } } return '<div id = "uc_popup">'. $output .'</div>'; } }
In general, the content is already displayed in the pop-up, only there are a few moments. This does not work javascript to update product items from the module uc ajax cart (you can solve a little bit by correcting the code, but this is for yourself). On this occasion, I disabled the “Ajaxify cart page” feature in the module settings.
Next, install the uc js cart module - this is exactly what allows you to dynamically calculate the cost.
That's almost all. The rest can be done using css.
Only one thing remains, when we open the basket and add or reduce the number of positions, nothing changes in the basket block itself when the popup window is closed. Here, too, you need to add a piece of JavaScript code to update. (We are doing this)
It looks like this to me:

')
If someone from the readers solved this question more gracefully, correctly and most importantly quickly and as a thread, tell pliz.
Thanks to all!
PS
At the moment we have the need to write a pop-up basket module. This is what we do. The module will be laid out for the test on drupal.ru and will be available for both the 6th and 7th branches of Drupal.