In the hook uc_ajax_cart_block you are using:

//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:

$contents = module_invoke_all('ajax_cart_viewblock');
if (!empty($contents[0])) {
  $content = $contents[0];
}
else {
  $content=uc_cart_block($op,$delta,$edit);
}

Comments

erik seifert’s picture

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 ?

erik seifert’s picture

Ha how about this. We could make a 'template' support.


$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 ?

Vetkhy’s picture

But this functionality, what you want, should go directly to uc_cart.

Well, maybe...

We could make a 'template' support

In the ajax cart module?

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?

Sorry, I little bit confused... I'll try to describe how I understand your idea.

I will implement cart_template hook 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?

erik seifert’s picture

I will implement cart_template hook 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?

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.

Vetkhy’s picture

OK! Why not? Please let me know, when I can try to implement it!

erik seifert’s picture

I will make an proof of concept and give you a special version till next week. So you can try it out ;- )

Vetkhy’s picture

Hello! What about our idea?..

erik seifert’s picture

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 ?

Vetkhy’s picture

im very busy these days

Oh, I'm sorry too.

Do you know how i can make only a development release without a official release?

Do you mean "development snapshot", something like your "alpha1" or something else?

erik seifert’s picture

Yeah but without a official release .

Vetkhy’s picture

Umm... No...

erik seifert’s picture

Have a look in 2.0-Alpha5 with template support.

Vetkhy’s picture

OK, I'll see it.

Vetkhy’s picture

Version: 6.x-1.0-rc9 » 6.x-2.0-alpha5

Hello again!
The UI is very beautiful now, but the idea:

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 )

seems to be unrealized.
Is the custom theming (override theme uc_ajax_cart_block_content) only way to change templates by another module?

erik seifert’s picture

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.

Vetkhy’s picture

Thank you! So I'll think about 'preprocess' hook.

erik seifert’s picture

Status: Active » Fixed

I think this is now possible to have a custom layout for cart. But next step is to create a view for cart content.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.