Posted by Vetkhy on April 10, 2009 at 2:15pm
Jump to:
| Project: | Ubercart ajax cart |
| Version: | 6.x-2.0-alpha5 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Vetkhy |
| Status: | closed (fixed) |
Issue Summary
In the hook uc_ajax_cart_block you are using:
<?php
//Only a wrapper to uc_cart_block
$content = uc_cart_block($op,$delta,$edit);
?>But what about to make a new hook to make a chance to override standard Ubercart block? (e.g. to integrate with my own Pictured cart block).
The draft of the code:
<?php
$contents = module_invoke_all('ajax_cart_viewblock');
if (!empty($contents[0])) {
$content = $contents[0];
}
else {
$content=uc_cart_block($op,$delta,$edit);
}
?>
Comments
#1
This is not my intend to make a new cart. I only want to extend uc_cart for ajax capabilities. But this functionality, what you want, should go directly to uc_cart.
But i will have an look on your module. Because there could be a better way ?
#2
Ha how about this. We could make a 'template' support.
<?php
$themings = module_invoke_all('cart_template');
function uc_ajax_cart_cart_template()
{
return array(
'function' => 'theming_function_to_call'
);
}
?>
So any module can make a new theming function for display cart. So a administrator can change a cart view like
* Normal view ( uc_cart )
* With images ( uc_pic_cart_block )
Sounds good ?
#3
Well, maybe...
In the ajax cart module?
Sorry, I little bit confused... I'll try to describe how I understand your idea.
I will implement
cart_templatehook that return name of theme function (and, of course, theme function also). Then administrator should change a cart view in the settings of your block (module), shouldn't he?#4
Yeahh ;- ). That was my intention . So i can make a default implementation for uc_cart. That could also override this cache for anonymous user ( click here to see cart ).
But this should be go in 2.0 ;- ) . But i will make a proof of concept.
#5
OK! Why not? Please let me know, when I can try to implement it!
#6
I will make an proof of concept and give you a special version till next week. So you can try it out ;- )
#7
Hello! What about our idea?..
#8
Sorry, im very busy these days. But on the other side. Do you know how i can make only a development release without a official release ?
#9
Oh, I'm sorry too.
Do you mean "development snapshot", something like your "alpha1" or something else?
#10
Yeah but without a official release .
#11
Umm... No...
#12
Have a look in 2.0-Alpha5 with template support.
#13
OK, I'll see it.
#14
Hello again!
The UI is very beautiful now, but the idea:
seems to be unrealized.
Is the custom theming (override theme
uc_ajax_cart_block_content) only way to change templates by another module?#15
Now you have two options to override layout.
(1) Write your own 'preprocess' hook ( see "uc_ajax_cart_preprocess_uc_ajax_cart_block_content" in see in uc_ajax_cart.theme.inc .
(2) Write your own template for example uc_ajax_cart_block_content.tpl.php
I think the best way, for making better theming, is to have a view for cart contents. This should be very nice for building your own cart and give you an complete control over layout and data.
#16
Thank you! So I'll think about 'preprocess' hook.
#17
I think this is now possible to have a custom layout for cart. But next step is to create a view for cart content.
#18
Automatically closed -- issue fixed for 2 weeks with no activity.