Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Your Add-On Needs A New Hook In Cs-Cart. Post It Here. Rate Topic   * * * * * 1 votes

 
  • imac
  • CTO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 1,849 posts

Posted 30 June 2015 - 10:02 PM #21

Functions which works with destinations do not have any hooks at all. Please check


I added hooks to the following functions:
fn_get_states
fn_get_countries
fn_get_destinations
fn_get_avilable_desintaion

Will be included in 4.3.4 or 4.3.5
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10,137 posts

Posted 30 June 2015 - 10:21 PM #22

You can do the test of page_id in the hook.

A terrific enhancement for override hooks would be to have the original content available in a capture variable so you could (for example) in your override file:
{if $page_id == 123}
do this code
{else}
$smarty.capture.[hook_name]
{/if}

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 251 posts

Posted 13 July 2015 - 01:11 PM #23

Hello.

Line 168 in /app/controllers/backend/cart.php

fn_set_hook('pre_get_carts', $params, $fields, $sortings);

Thank you
Robert

Team of SoftSolid
cs-cart.pl


 
  • imac
  • CTO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 1,849 posts

Posted 15 July 2015 - 08:47 AM #24

Hello.

Line 168 in /app/controllers/backend/cart.php

fn_set_hook('pre_get_carts', $params, $fields, $sortings);

Thank you
Robert

Functions will be moved to fn.cart.php.
After the hooks are added I will let you know.
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 

Posted 20 July 2015 - 11:28 AM #25

Will be there in 4.3.4 or 4.3.5


Awesome. Thanks!

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 11 August 2015 - 05:55 AM #26

In fn.init.php -> fn_init_currency
function fn_init_currency($params, $area = AREA)
{
    $_params = array();
    if (fn_allowed_for('ULTIMATE:FREE')) {
	    $_params['only_primary'] = 'Y';
    } elseif ($area == 'C') {
	    $_params['status'] = array('A', 'H');
    } else {
	    $_params['status'] = array('A', 'H');
    }
    $currencies = fn_get_currencies_list($_params, $area, CART_LANGUAGE);

fn_set_hook('init_currency', $params);


 
  • imac
  • CTO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 1,849 posts

Posted 11 August 2015 - 08:29 PM #27

In fn.init.php -> fn_init_currency

function fn_init_currency($params, $area = AREA)
{
	$_params = array();
	if (fn_allowed_for('ULTIMATE:FREE')) {
		$_params['only_primary'] = 'Y';
	} elseif ($area == 'C') {
		$_params['status'] = array('A', 'H');
	} else {
		$_params['status'] = array('A', 'H');
	}
	$currencies = fn_get_currencies_list($_params, $area, CART_LANGUAGE);

fn_set_hook('init_currency', $params);


Why do you need hook in fn_init_currency? Maybe it would be more appropriate to have hook in fn_get_currencies_list?
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • imac
  • CTO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 1,849 posts

Posted 11 August 2015 - 08:39 PM #28

In fn.init.php -> fn_init_currency


Link to a discussion is always welcom:) http://forum.cs-cart...__fromsearch__1

Ok will investigate this and add required hooks.
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 12 August 2015 - 05:30 AM #29

Link to a discussion is always welcom:) http://forum.cs-cart...__fromsearch__1

Ok will investigate this and add required hooks.


Sorry ... I was just about to post it but you found it anyway :grin:

 

Posted 19 August 2015 - 03:20 PM #30

Hi,

Could we have a hook in fn_auth_routines so we can specify which field it should look for a username?

At the moment its hardcoded to email, but we would like this to change to user_login and be able to login with both email and username.

 
  • imac
  • CTO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 1,849 posts

Posted 24 August 2015 - 08:37 AM #31

In fn.init.php -> fn_init_currency

function fn_init_currency($params, $area = AREA)
{
	$_params = array();
	if (fn_allowed_for('ULTIMATE:FREE')) {
		$_params['only_primary'] = 'Y';
	} elseif ($area == 'C') {
		$_params['status'] = array('A', 'H');
	} else {
		$_params['status'] = array('A', 'H');
	}
	$currencies = fn_get_currencies_list($_params, $area, CART_LANGUAGE);

fn_set_hook('init_currency', $params);


Will be there in 4.3.5 only. That's because 4.3.4 branch is closed for new changes already.
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • imac
  • CTO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 1,849 posts

Posted 24 August 2015 - 08:42 AM #32

Hi,

Could we have a hook in fn_auth_routines so we can specify which field it should look for a username?

At the moment its hardcoded to email, but we would like this to change to user_login and be able to login with both email and username.

I've created a task.
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 25 August 2015 - 10:03 AM #33

Will be there in 4.3.5 only. That's because 4.3.4 branch is closed for new changes already.

Great ... thanks :)



 

Posted 26 August 2015 - 08:56 AM #34

Not a new hook, just an extra parameter added to an existing one.

 

save_cart should also include the $user_type variable.

 

So 

fn_set_hook('save_cart', $cart, $user_id, $type);

would become

fn_set_hook('save_cart', $cart, $user_id, $type, $user_type);

in app/functions/fn.cart.php:1472

 

Thanks!



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10,137 posts

Posted 26 August 2015 - 07:30 PM #35

$user_type = db_get_field("SELECT user_type FROM ?:users WHERE user_id=?i", $user_id);
if( $user_type === false )
  $user_type = 'C';

Note that a cart can be saved for a user that does not have an account.  You can alternatively do this via

$user_type = empty($_SESSION['auth']['user_type']) ? 'C' : $_SESSION['auth']['user_type'];

But this would NOT work when admin is acting on behalf of.

 

A hook should be considered like an API.  If it's easy to get the info without adding a parameter, one should approach it that way.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 03 September 2015 - 01:12 PM #36

Hi tbirnseth, thanks for your reply.

 

I have used the code you provided, although it does require an extra unnecessary database query when the data is already readily available in the code therefore it would still make sense for it to be passed through in the hook.

 

-------------------------------------------------------------

 

Another hook suggestion for fn_create_order_details:

 

v4.3.1 app/functions/fn.cart.php:1093

fn_set_hook('create_order_details', $order_id, $cart, $order_details);

Thanks



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10,137 posts

Posted 03 September 2015 - 05:52 PM #37

Don't think user_type is part of the order_details.  Maybe but I wouldn't rely on it given the query will address it regardless of whether it is the user manipulating the order or an admin acting on behalf of.... 

 

User_data is available in a cart.  But once an order is created, I think the only 'user_data' that remains with the order is the user_id.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3,446 posts

Posted 16 September 2015 - 09:30 AM #38

Need a template hook to minipulate the product price wherever it may show up.  Currently in some of the templates, overriding the price includes overriding other hooks.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10,137 posts

Posted 16 September 2015 - 07:54 PM #39

There are already 2 hooks in common/product_data.tpl for product prices:

{hook name="products:old_price"}
{hook name="products:prices_block"}

What additional hooks do you require for product price?  I think most all displays of product price uses {$product_data.price} which those hooks can modify.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3,446 posts

Posted 17 September 2015 - 12:37 AM #40

These are currently the hooks I have to use and they use {$smarty.capture.$price nofilter}.  The first one is the main concern.  The others just interfere with other data.  I will look into the hook you provided.
 
 
blocks/product_templates/default_template.tpl
{hook name="products:view_main_info"}
 
blocks/list_templates/compact_list.tpl
{hook name="products:product_compact_list"}
 
blocks/list_templates/grid_list.tpl
{hook name="products:product_multicolumns_list"}
 
blocks/list_templates/links_thumb.tpl
{hook name="products:product_thumbnail_list"}
 
blocks/list_templates/products_list.tpl
{hook name="products:product_block_content"}
blocks/list_templates/simple_list.tpl
No hooks
blocks/list_templates/small_items.tpl
{hook name="products:product_small_item"}

Edit: Yep, looks like the prices_block hook is the way to go.