Forums / Setting Up Categories, Products, Attributes / Creating an add-on "product type book" for ZC 1.5

Creating an add-on "product type book" for ZC 1.5

Views: 111,142

Results 41 to 60 of 427
21 Oct 2013, 1:50 PM
#41
magda_s avatar

magda_s

New Zenner

Join Date:
Jul 2013
Location:
Sweden
Posts:
3
Plugin Contributions:
0

Creating an add-on "product type book" for ZC 1.5

Hi, a long over due response from my side, but other work got in the way.

I just installed the "new" beta version and and it looks and works great from what I can see, very nice. This is enough for us
to get going I think, the text field is visible again and the link "For more information, please visit this product's webpage" also works the way it should!

Presentation also much improved - thanks a lot for creating this, we can now move the the implementation stage of our Zen cart project!

Cheers,
Magda

21 Oct 2013, 3:19 PM
#42
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hi Magda,

nice to hear that, I have unfortunately also been kept away from this project recently!
Were you the one who requested "keywords" and then I suggested solving this via META tag keywords? And did your combination with the ZC add-on extra field work out?
Thanks for briefly sharing what works for you, so others can follow the same path.

Regards,
p.

24 Oct 2013, 2:34 PM
#43
breda avatar

breda

New Zenner

Join Date:
Dec 2009
Posts:
32
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

Hello,
Thanks for the module.
I have a question about the convert existing products, I have tried to convert a product type music to product type book but after I select the product and click confirm nothing happens, should something appear on the screen to say it has completed? The product does not change?
Thanks,
Breda

24 Oct 2013, 2:49 PM
#44
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hi Breda,

there is no feedback und you seem to be right, that conversion of music type to bookx type is not working.
I will check that in the next days and post an update here.
p.

26 Oct 2013, 4:05 PM
#45
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hi Breda,

fortunately there seems to be a simple solution to fix this:
When you are trying to convert certain products to product type BookX, you first choose the product type via a popup control. Let's say you choose "Music" at this stage. If you then pick the option where you choose from a list of products of type "Music" the page reloads and you get a multiple-selction field where you can pick a product. Now here's the bug: when the page reloads between these two steps, the popup where you choose the type to convert from resets back to "Product - General". That is why your product is not converted. If you reselect e.g. "Music" in our example, then your product should be converted properly.

This is marked to be fixed in the next release.

Regards,
p.

5 Nov 2013, 12:49 PM
#46
breda avatar

breda

New Zenner

Join Date:
Dec 2009
Posts:
32
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

Thanks P.

Can you help with another question, when I add the standard Zen cart attributes, in this case for Colour Options, they display fine on the page but when I choose a colour and add to cart I get an error message.
I looked at the log debug files and it says:

[05-Nov-2013 12:31:13] PHP Warning: include_once(DIR_FS_CATALOG_LANGUAGESenglish/product_bookx_info.php): failed to open stream: No such file or directory in /hsphere/local/home/garrettmallon/garrettmallon.com/upgrade/includes/classes/observers/class.bookx_observers.php on line 554
[05-Nov-2013 12:31:13] PHP Warning: include_once(): Failed opening 'DIR_FS_CATALOG_LANGUAGESenglish/product_bookx_info.php' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/garrettmallon/garrettmallon.com/upgrade/includes/classes/observers/class.bookx_observers.php on line 554

I have checked and the files mentioned above are on the server in correct folders but I noticed that this path seems to be missing a forward slash?
PHP Warning: include_once(DIR_FS_CATALOG_LANGUAGESenglish/product_bookx_info.php):
I presume it should be PHP Warning: include_once(DIR_FS_CATALOG_LANGUAGES/english/product_bookx_info.php):

I have looked at the code on the page class.bookx_observers.php and can't see a problem with the path.
Any ideas?
Thanks
B

5 Nov 2013, 1:23 PM
#47
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hi Breda,

DIR_FS_CATALOG_LANGUAGES is a php constant defined to point to the path of the languages folder of your installation. It is defined inside [youradmin]/includes/configure.php
If this constant is not defined when the php script runs, then the script inserts the literal name of the constant, i.e. "DIR_FS_CATALOG_LANGUAGES", which is why it shows up in the error message.
I will quickly run the script here to see why this constant is not defined, possibly because it is only defined inside the [admin] file described above. Although I'm surprised I never got the error here...

Best,
p

5 Nov 2013, 1:42 PM
#48
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

The constant DIR_FS_CATALOG_LANGUAGES is in fact only defined for the admin backend, so that is why there is an error. For some reason my PHP always ran over this error without stopping the script, so that is why I never noticed. :)

Anyway, until this is fixed in a next release, please modify the lines inside includes/classes/observers/class.bookx_observers.php on line 554

OLD:
include_once DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/product_bookx_info.php';
include_once DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/extra_definitions/product_bookx.php';

NEW:
include_once DIR_FS_CATALOG . 'includes/languages/' . $_SESSION['language'] . '/product_bookx_info.php';
include_once DIR_FS_CATALOG . 'includes/languages/' . $_SESSION['language'] . '/extra_definitions/product_bookx.php';

Let me know if that works.

Best,
p.

6 Nov 2013, 7:09 PM
#49
breda avatar

breda

New Zenner

Join Date:
Dec 2009
Posts:
32
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

Hi P,
I've made that change and I'm still getting an error but it's a different one now.
I am chosing a product that has the colour attributes ( the zen cart standard ones) and the log file is showing this error now:
[06-Nov-2013 19:03:49] PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':4a7c8ee9be3c480825a33121ab45d533,31)
GROUP BY be.products_id' at line 8 :: SELECT be.products_id, be.volume, bed.products_subtitle,
CONCAT_WS("-", SUBSTRING(be.isbn,1,3), SUBSTRING(be.isbn,4,1), SUBSTRING(be.isbn,5,6), SUBSTRING(be.isbn,11,2), SUBSTRING(be.isbn,13,1)) AS isbn_display,
GROUP_CONCAT(DISTINCT a.author_name ORDER BY a.author_name ASC SEPARATOR " | ") AS authors
FROM product_bookx_extra be
LEFT JOIN product_bookx_extra_description bed ON bed.products_id = be.products_id AND bed.languages_id = "1"
LEFT JOIN product_bookx_authors_to_products atp ON atp.products_id = be.products_id
LEFT JOIN product_bookx_authors a ON atp.bookx_author_id = a.bookx_author_id
WHERE be.products_id IN (106:4a7c8ee9be3c480825a33121ab45d533,31)
GROUP BY be.products_id in /hsphere/local/home/garrettmallon/garrettmallon.com/upgrade/includes/classes/db/mysql/query_factory.php on line 120

########################################___
I am wondering if the issue is that the Book X uses a seperate database and there is no table for the colour attributes? If that is the case I would have thought that it would not display the standard zen cart attributes on the browser view, it works fine until you click Add to Cart. You can try it here:
http://www.garrettmallon.com/upgrade/index.php?main_page=product_bookx_info&cPath=10&products_id=106

Thanks for your help, I'd appreciate if you can respond asap as Client is testing tomorrow!
Regards
Breda

6 Nov 2013, 7:48 PM
#50
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hi Breda,

BookX uses the "normal" table for ZC products and then just adds the BookX specific fields in an extra table, so that shouldn't get in the way of your using attributes.
I have never used ZC attributes before, but quickly looking into the issue it seems to me the way ZC internally deals with identifying products with attributes doesn't play nicely with BookX.
I will do my best to test this here in the next days and hopefully find a quick fix.

p.

6 Nov 2013, 8:03 PM
#51
breda avatar

breda

New Zenner

Join Date:
Dec 2009
Posts:
32
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

Thanks P,
It seems to be the add to cart step that causes the error and if you go back a step in the browser you'll see that the side box for Shopping cart has the product added in, so it seems to add it to the cart but can't display the cart page.
Regards
Breda

7 Nov 2013, 2:24 PM
#52
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hi Breda,

this needs another change inside , which will be part of the next release:
I'm not sure of the line numbers you have after the first change, but I'm sure you will find it. Should be somewhere after line 550.

replace this line:
$ids[$product['id']] = $key;

with these lines:

if (!empty($product['attributes'])) {
	//*** this product with attributes, so ID needs to be cleaned
	$id_parts = explode(':', $product['id']);
	$ids[$id_parts[0]] = $key;
} else {
	$ids[$product['id']] = $key;
}

Hope that works. Let us know.
Best,
p.

7 Nov 2013, 3:05 PM
#53
breda avatar

breda

New Zenner

Join Date:
Dec 2009
Posts:
32
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

Hi P,
Brilliant that fixed it!
I must make a donation to your site.
Thanks,
Breda

7 Nov 2013, 3:12 PM
#54
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

breda:

Hi P,
Brilliant that fixed it!
I must make a donation to your site.
Thanks,
Breda

Glad it works now.
I'll buy the cat some caviar then ;)

Best,
p.

7 Nov 2013, 3:12 PM
#55
breda avatar

breda

New Zenner

Join Date:
Dec 2009
Posts:
32
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

Lucky cat!
B

3 Dec 2013, 9:29 AM
#56
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Hey Breda,

thank you so much for your donation!
I'm working on the 1.0 release. Currently testing the plugin in a real-life shop environment and I discover a few little bugs so once that's fixed I'll post it here.

Best wishes,
p.

5 Dec 2013, 4:14 AM
#57
bwidener avatar

bwidener

New Zenner

Join Date:
Dec 2013
Location:
United States
Posts:
2
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

I have been helping a friend with a bookstore site and have installed your plugin. It is at resurrectedreads.com. A couple of immediate issues that I was wondering about.

  1. Bulk import? Can the info be imported at all from a csv or spreadsheet?

  2. On a book detail page, there is a section "Other books by %s:" Can this be fixed to have the authors name?

Thanks for the help in advance, and keep up the good work!

Brice

5 Dec 2013, 8:09 AM
#58
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Creating an add-on "product type book" for ZC 1.5

bwidener:

I have been helping a friend with a bookstore site and have installed your plugin. It is at resurrectedreads.com. A couple of immediate issues that I was wondering about.

  1. Bulk import? Can the info be imported at all from a csv or spreadsheet?

  2. On a book detail page, there is a section "Other books by %s:" Can this be fixed to have the authors name?

Thanks for the help in advance, and keep up the good work!

Brice

1: Bulk import should be possible, when you use Easy populate 4 it is very easy to add extra field you would like to add to the import besides the standard fields.

2: Not sure why you see %s but that should automatically be replaced by the name of the author, maybe philou van help with that.

5 Dec 2013, 12:20 PM
#59
philou avatar

philou

Zen Follower

Join Date:
Jan 2006
Posts:
165
Plugin Contributions:
1

Re: Creating an add-on "product type book" for ZC 1.5

Design75:

1: Bulk import should be possible, when you use Easy populate 4 it is very easy to add extra field you would like to add to the import besides the standard fields.

2: Not sure why you see %s but that should automatically be replaced by the name of the author, maybe philou van help with that.

Thanks to Design 75 for suggesting Easy Populate. I have in fact never used that, so I can't say too much about it.
I don't know if Easy Populate can also create product entries for other types than "Product - General". If you can get your books into the shop as "Product – General" you can use the BookX Tool to convert those to product type "BookX".

That saves you already some time, but it will only work with basic info, your Bookx "extra info" will have to be added by hand (or directly in the MYSQL DB, but that's tricky). BookX has it's own table for special fields like "subtitle", "ISBN" etc. I doubt that Easy Populate can find those and populate them correctly. Quickly looking at the code I also see a shortcoming in my code for the conversion of "Product - general" to "BookX". Now is however not a good time for me to improve this. I will put it on my list for the next release planned for January 2014. A bulk-import via BookX Tool should not bee terribly difficult for me to add, but most probably not for the 1.0 release.

2.) That the "%s" is in your HTML output is very strange. I thought the PHP command "sprintf" fails gracefully, meaning it should in the worst case show "Other books by :", but not the variable placeholder "%s"… Also, on the page I saw on your site, you do have an author assigned to the book, so I don't understand why it is not shown there then. Must in fact be a bug. Since it works here, I'm not sure for the moment how to proceed finding the bug there. Do you have debugging on in your Shop? If so, maybe there is something relating to this in the debug logs in the "cache" folder of your site? Just make a page request and see if a brand new log appears.
Another possibility is that it is a bug that I already fixed in my current development version of the plugin, but again I can't check that now unfortunately.

Hope all that helps you along !

Best,
philou

9 Dec 2013, 3:16 AM
#60
bwidener avatar

bwidener

New Zenner

Join Date:
Dec 2013
Location:
United States
Posts:
2
Plugin Contributions:
0

Re: Creating an add-on "product type book" for ZC 1.5

philou:

Thanks to Design 75 for suggesting Easy Populate. I have in fact never used that, so I can't say too much about it.
I don't know if Easy Populate can also create product entries for other types than "Product - General". If you can get your books into the shop as "Product – General" you can use the BookX Tool to convert those to product type "BookX".

That saves you already some time, but it will only work with basic info, your Bookx "extra info" will have to be added by hand (or directly in the MYSQL DB, but that's tricky). BookX has it's own table for special fields like "subtitle", "ISBN" etc. I doubt that Easy Populate can find those and populate them correctly. Quickly looking at the code I also see a shortcoming in my code for the conversion of "Product - general" to "BookX". Now is however not a good time for me to improve this. I will put it on my list for the next release planned for January 2014. A bulk-import via BookX Tool should not bee terribly difficult for me to add, but most probably not for the 1.0 release.

2.) That the "%s" is in your HTML output is very strange. I thought the PHP command "sprintf" fails gracefully, meaning it should in the worst case show "Other books by :", but not the variable placeholder "%s"… Also, on the page I saw on your site, you do have an author assigned to the book, so I don't understand why it is not shown there then. Must in fact be a bug. Since it works here, I'm not sure for the moment how to proceed finding the bug there. Do you have debugging on in your Shop? If so, maybe there is something relating to this in the debug logs in the "cache" folder of your site? Just make a page request and see if a brand new log appears.
Another possibility is that it is a bug that I already fixed in my current development version of the plugin, but again I can't check that now unfortunately.

Hope all that helps you along !

Best,
philou

In which file would I find the "Other books by"? I would like to change it to "Other books by this author" or something generic like that.

Brice