Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / cant add new functions to general.php or extra_functions folder

cant add new functions to general.php or extra_functions folder

Views: 943

Results 1 to 4 of 4
15 Jul 2011, 1:32 PM
#1
skychew avatar

skychew

New Zenner

Join Date:
Jul 2011
Posts:
4
Plugin Contributions:
0

cant add new functions to general.php or extra_functions folder

Hi i have been trying to add new product type to zencart and is succesfull half way. i cant seem to add new functions to general.php or as a new products_new_functions.php

following this help
blog.kineticpulse.co.uk/2010/11/creating-new-product-type-in-zen-cart.html

this is the function im trying to add

  function zen_get_products_airline($product_id, $language_id) {
    global $db;
    $product = $db->Execute("select products_airline
                             from " . TABLE_PRODUCTS_DESCRIPTION . "
                             where products_id = '" . (int)$product_id . "'
                             and language_id = '" . (int)$language_id . "'");

    return $product->fields['products_airline'];
  }

the moment i add a new fucntion in general.php or a new file in extra_functions.

the admin area shuts down.

only get black page;

<html> <head></head> <body></body> </html>
15 Jul 2011, 1:37 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: cant add new functions to general.php or extra_functions folder

All PHP files need to start with <?php on the first line. The code you posted doesn't have this, so likely is triggering an "unexpected T_STRING" error.
You can see what errors you're triggering by using the myDebug logs: https://www.zen-cart.com/tutorials/index.php?article=82

16 Jul 2011, 3:00 AM
#3
skychew avatar

skychew

New Zenner

Join Date:
Jul 2011
Posts:
4
Plugin Contributions:
0

Re: cant add new functions to general.php or extra_functions folder

got it working!

installed that debug tool and saw that

i had function name clash

zen_get_products_type

16 Jul 2011, 3:31 AM
#4
skychew avatar

skychew

New Zenner

Join Date:
Jul 2011
Posts:
4
Plugin Contributions:
0

Re: cant add new functions to general.php or extra_functions folder

thanks dr byte. didnt see your reply.

but yeah i knew that i was trying to show the code part if there was anything wrong with it.

creating a new product type is so much work! cant it be implemented like how we are adding options or attributes to a product?