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 81 to 100 of 427
22 Jan 2014, 7:51 PM
#81
suportafaceri avatar

suportafaceri

New Zenner

Join Date:
Jun 2012
Posts:
32
Plugin Contributions:
1

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

:D I manage (the easyest way that i found) to put the extra info on separate tabs (I also use Tabbed Products Pro v1.10) by using the moving the extra info from the tpl_product_bookx_info_display to a custom tab so that is probably why it's working in that manner.
Unfortunatly i keep trying to cut conrners and maby that is way I scramble things up.

27 Jan 2014, 6:59 PM
#82
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

Hi phil,

Thank you for all your hard work on this! I've been testing it out over the last few days and absolutely love the extra flexibility it will give me. :-)

I do have a couple of questions -- I'm not sure if these are bugs or if I've screwed something up, and I apologize in advance for the length of this post. I'm using the beta .92 version from SourceForge, on a test environment running zen 1.5.1.

When I installed, I ran into the error "WARNING: An Error occurred, please refresh the page and try again." Everything seemed to install okay, as all the listings showed up correctly under the admin Extras menu and also under Product Type. When I checked my logs, I found this:

[27-Jan-2014 11:28:14 America/Denver] 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 '(configuration_title, configuration_key, languages_id, configuration_description' at line 1 :: REPLACE INTO (configuration_title, configuration_key, languages_id, configuration_description, last_modified, date_added)
VALUES
# settings for product type bookx only
('Artikelliste: Artikelnummer anzeigen', 'SHOW_PRODUCT_BOOKX_LISTING_MODEL', 43, 'Artikelnummer in der Artikelliste anzeigen.', now(), now()),

It goes on with a bunch more German settings, and ends with:

; in /home3/lesstha1/public_html/ztest/includes/classes/db/mysql/query_factory.php on line 120

I'm not sure if this affected anything or if it's related to any of the other issues I've encountered, but I figured it couldn't hurt to mention. The biggest problem I've run into is that the filter links don't work for me. The syntax is correct, so far as I can tell -- /index.php?main_page=index&typefilter=bookx&bookx_genre_id=6 -- but I get that same "WARNING: An Error occurred..." message when I click any of the links. Is there something I need to turn on for this? My site's design doesn't use sidebars, so if I need to turn on something behind the scenes, let me know. The log for this says:

[27-Jan-2014 11:43:41 America/Denver] PHP Fatal error: 1054:Unknown column 'm.manufacturers_name' in 'field list' :: SELECT p.products_image, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_id, p.products_type, p.master_categories_id, p.products_price, p.products_tax_class_id, pd.products_description,
IF(s.status = 1, s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price,
p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status, prodt.type_handler AS product_type_handler FROM products p
LEFT JOIN products_description pd ON (pd.products_id = p.products_id AND pd.language_id = "1")
LEFT JOIN specials s on p.products_id = s.products_id
LEFT JOIN product_types prodt ON prodt.type_id = p.products_type
LEFT JOIN product_bookx_extra be ON be.products_id = p.products_id LEFT JOIN product_bookx_genres_to_products gtp ON gtp.products_id = be.products_id
LEFT JOIN product_bookx_genres g ON gtp.bookx_genre_id = g.bookx_genre_id
LEFT JOIN product_bookx_genres_description gd ON gd.bookx_genre_id = gtp.bookx_genre_id AND gd.languages_id = "1" WHERE p.products_status = 1 AND g.bookx_genre_id = "6" order by p.products_sort_order, pd.products_name in /home3/lesstha1/public_html/ztest/includes/classes/db/mysql/query_factory.php on line 120

One of the other things I've run into is that when I update a product with the Bookx product type, the description disappears after I save it. This used to be an issue for me before I upgraded to 1.5.1 and PHP 5.4, but I haven't encountered it in ages. The products still assigned "Product - General" type don't have this problem.

Other, more minor things -- I can't get the series to display on the product info page, no matter what I do, and when adding multiple authors to a product, only one (the last one assigned) is saved (going back in and adding another is fine -- it only saves one per edit). (I had no problem adding multiple genres works fine.)

If you need any more information or want me to test anything, let me know. Thanks again!

Sasha

28 Jan 2014, 11:31 PM
#83
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 Sasha,

the warning during install seems to be caused by a missing table in the SQL statement. That table name is supposed to be inserted by means of a variable, so I suspect this is not working due to ZC version 1.5.1. Unfortunately I am away from my development environment at the moment, so I can only look into this again next monday.

The statements after the failed SQL statement are not crucial for the BookX plugin operation, but they should be executed, which they are not in your case due to this error. If you want to fix this urgently, you could comment out this step in the Bookx installation script. If you don't see what I mean by that, then maybe you better leave it until I can check it out next week :-)

The filter seems to have another SQL problem, maybe I had disabled display of manufacturer info in my dev shop and therefore never encountered this bug? Whatever the reason, you may be able to circumvent this by disabling the display of manufacturer info in product listings for now until I find the bug.

Disappearing product description and missing display of series are bugs which I am aware of and which are already fixed in my current development version.

I really hope to be able to publish this soon!

Best regards,
p.

29 Jan 2014, 7:26 PM
#84
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

I found the SQL statement and managed to comment it out without killing anything. That ran successfully, with just a warning about my template overrides (which were done on purpose in the name of testing out some product display formatting, so the warning is valid ;3).

For the filter, I tried turning off the manufacturer on the bookx and then onall other product types, but I'm still running into the error when I click on any of the filters. I get the same error in the log, too.

If there's anything you want me to test or try for you, let me know, I'm more than willing to help out. (Also, no rush on my behalf; I'm looking forward to implementing, but it's not time sensitive or anything, and I appreciate the work you're putting into it.)

Thanks again!

Sasha

29 Jan 2014, 11:39 PM
#85
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 Sasha,

fine. I forgot to adress the problem of only the last author being registered in the DB when editing productinfo, this problem is new to me indeed, as it has worked here without problems. I will let you know if I don't succeed to replicate the error.

So more on all this in a weeks time.

Regards,
p.

2 Feb 2014, 8:42 PM
#86
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 Sasha,

the manufacturer error is really a bug. Here is how you can fix it until a new version is out.
in [YOUR_ZEN_CART_INSTALLATION]/includes/index_filters/bookx_filter.php you have to change the code around line 76
from this:

LEFT JOIN ' . TABLE_PRODUCT_BOOKX_EXTRA . ' be ON be.products_id = p.products_id';

to this:

LEFT JOIN ' . TABLE_PRODUCT_BOOKX_EXTRA . ' be ON be.products_id = p.products_id
LEFT JOIN ' . TABLE_MANUFACTURERS . ' m ON m.manufacturers_id = p.manufacturers_id';

That should make the error go away.
I am stil looking into the installation script, but this way you can keep working.

Regards,
p.

nikerymis:

I'm not sure if this affected anything or if it's related to any of the other issues I've encountered, but I figured it couldn't hurt to mention. The biggest problem I've run into is that the filter links don't work for me. The syntax is correct, so far as I can tell -- /index.php?main_page=index&typefilter=bookx&bookx_genre_id=6 -- but I get that same "WARNING: An Error occurred..." message when I click any of the links. Is there something I need to turn on for this? My site's design doesn't use sidebars, so if I need to turn on something behind the scenes, let me know. The log for this says:

3 Feb 2014, 8:48 PM
#87
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

That did the trick! Everything is working for me now, and I'll probably implement on our live site later this week. Any chance I could get the fix for the disappearing product descriptions? I can use my workaround if not (updating product descriptions in the database directly), but that's probably the biggest remaining issue, user-flow-wise for me.

Thanks again!

Sasha

3 Feb 2014, 10:02 PM
#88
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 Sasha,

many thanks for the donation, that is very kind of you and much appreciated!

I am considering to release yet another Beta version, even if I was hoping to make the jump to 1.0 directly. I'm worried that giving you some files from the next release will introduce other problems when combined with files of a previous version, so i prefer not to do it that way.

I'll see what I can do...

Regards,
p.

3 Feb 2014, 10:09 PM
#89
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

Hey Phil,

No problem! :)

I'm pulling for another beta release, but I can also hold my horses and wait for a 1.0 release. Whichever you want to do, I will still be using. :)

Sasha

3 Feb 2014, 10:22 PM
#90
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

Sasha,

could you give me more details about the disappearing product descriptions: Are you saying that when converting products from another product type to bookx the descriptions are lost? Or do you mean that after your created a new product of type Bookx and entered a description, this description is somehow lost if you edit the product again and save the changes? I can't reproduce the problem in my development shop running the 0.9.2 version you are using.

Best,
p.

3 Feb 2014, 10:49 PM
#91
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

Converting is fine; when I go in to update the book, the description is still there. It's when I make any changes and go through the preview/update that the description is wiped. (Specifically, it's wiped on update, not preview). I don't actually have to make any changes at all -- I just clicked through on one of my bookx products without making any changes and it wiped. It is limited to the bookx products, too, as I ran through a general product and had no issue.

If it helps, I'm on PHP version 5.4.24 and 5.5.35 on SQL.

Sasha

5 Feb 2014, 10:41 PM
#92
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 Sasha,

I found the bug concerning addition of multiple authors at once. But I can't replicate the lost description issue. Maybe this could be in combination with a WYSIWYG editor? Could you try to turn the editor off and just use a plain text field? If it also wipes the description then I should keep looking into the script…

I just need to add a few lines to the documentation and then version 0.9.3 can be posted.

Regards,
p.

5 Feb 2014, 10:59 PM
#93
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

I only have a Plain Text editor. Unless there's an option I'm not seeing, but plain text is all I've ever used, and I can't find a WYSIWYG option anywhere. Are you using a WYSIWYG editor on your install? I'm willing to add additional plugins to see if that helps. I'm also willing to wipe my current test environment and start fresh with 0.9.3 to see if that helps in anyway.

I don't know if this is relevant, but I was running into this problem on occasion with the general products when I was still on 1.3.9h and on PHP 5.4, but upgrading to zen cart 1.5.1 / PHP 5.4 fixed that.

7 Feb 2014, 9:06 AM
#94
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

There is an updated beta version ready to download on sourceforge. It mainly fixes some bugs discussed here in the forum and some others I discovered myself :)

There is really only one new feature worth mentioning, which is the option to sort products in any product listing view (including Bookx filter results) by date of availability, placing CSS hooks on the TR elemnts for products "upcoming-product" and "new-product", so you can also style them differently.
If this is not for you, it can be turned off altogether in Admin->Catalog->Product Types->BookX Type->edit layout.

If anybody has a disappearing description problem, the experience of nikerymis might help:

It looks like the problem was the stock by attributes plugin I've been using (this one: http://www.zen-cart.com/downloads.php?do=file&id=202). Removing it in my test environment fixed that bug -- the product descriptions are no longer disappearing on me. I'll probably remove that in the live environment as well, since we're implementing a different process to deal with our stock. :-)

Thanks,
Sasha

Regards,
p.

10 Feb 2014, 8:42 PM
#95
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

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

An update on the disappearing product descriptions -- this problem was not caused by the Stock by Attributes plugin as I'd originally thought. It was an intermittent issue, which is why it appeared to be corrected when I tested after uninstalling Stock by Attributes.

The real cause of the error (and it took me an age to sort this out) was special characters in the product description. If the product description contained an emdash, an accented character, an ellipses character (not three periods, but one single character with three dots), the product description disappeared. Replacing these special characters with their HTML # codes fixed the issue completely. :-)

For reference, these are the HTML codes for special characters that I'm referring to: http://www.ascii.cl/htmlcodes.htm

  • Sasha
9 Jul 2014, 7:48 AM
#96
desmat avatar

desmat

New Zenner

Join Date:
Sep 2009
Posts:
23
Plugin Contributions:
0

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

Hi Philou
I really do not know, whether i am placing my issue at the right place,
I have set up the bookx addon, and the bug i am getting is as under

  1. There are several books which have multiple authors and multiple subjects, when ever the filter searches this kind of author, i get a sub filter which says "Text_all_music _genre" and another box asking for "items starting with", selecting anything brings me back to the index page. Except for this everything seems working fine,

Help required

Cheers

9 Jul 2014, 8:28 AM
#97
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 Desmat,

is your site online or do you only develop on your local machine? If you are already online somewhere, you could send me the URL (by private message of you prefer) and I could see better what your situation is. I am assuming you are using the sidebox with Bookx Filters, correct? Are you saying you get an additional pop-up inside that sidebox? Or are you on a result page for the search / filter?

If your site is not online, then the request URL could help me (or you ) in finding out what is going on. The Bookx Filters sidebox simply adds something to the URL to search for authors, like "&typefilter=bookx&bookx_author_id=14" for example looks for author with ID 14.

It would be especially interesting what the requested URL is which takes you back to the index page.

Regards,
p.

9 Jul 2014, 8:59 PM
#98
dmlyons avatar

dmlyons

New Zenner

Join Date:
Jul 2014
Location:
Boston, MA, USA
Posts:
47
Plugin Contributions:
0

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

Hi,

I'm using v1.5.1, and I tried to install. It fell flat. Nothing happened. I THINK the problem might have been the code I patched into tpl_tabular_display.php, as per the directions. Now, the directions say to paste that right at the top. I did. I also tried pasting it just below the text portion and one other place near the top of the file. Still nothing. The first paste was done with a text editor. When I started testing placements of the line in DreamWeaver, it REALLY didn't like anywhere I was trying to place that line. So... Can anyone tell me, with reference to another line in the file, what the proper place to put it would be? I would REALLY appreciate it, because this looks like a great plug-in.

Thanks,
DML

10 Jul 2014, 10:22 AM
#99
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 DML,

you are right, it's a nice little plug-in, so let's see if we can get it to work for you. To get to the root of the problem, let's calrify this: When you say "nothing happens" and you are looking at a page where "tpl_tabular_display.php" is being used, then you are looking for example at the product listing of a certain category which has Bookx-type products in the listing, yes? If BookX is working correctly, you should then see extra infos for these BookX products in the listing, for example an author or the ISBN. To test this further you could make a category in the admin backend called "bookx testing" and add one Bookx-type product there: "Bookx Test Product".
Now when you are listing the category "bookx testing" in your shop, it shows "Bookx Test Product" but in your case no extra book-info like number of pages or ISBN or author etc?
If this is the case then you are correct, the BookX plugin is not working correctly in your setup.

Why do you assume, that "tpl_tabular_display.php" is the problem? The BookX plugin tries to modify the ZC code as little as possible, so it is using the "notifier" functionality of ZC, which then calls the file [YOUR_ZC_INSTALLATION]/includes/classes/observers/class.bookx_observers.php. In the case of tpl_tabular_display.php there was no "notifier" which is why it has to be inserted manually. It must be placed anywhere in the file BEFORE the variable $list_box_contents is being used, because the Bookx Observer inserts the extra book info into $list_box_contents before it is then output into HTML.

If you want to test functionality of Bookx with a debugger, try setting a breakpoint inside [YOUR_ZC_INSTALLATION]/includes/classes/observers/class.bookx_observers.php to see if this file is being called. If it isn't then check if you have really copied all the BookX php files in the correct places or if maybe one is missing.

For example the function "update" around line 154 inside class.bookx_observers.php is a good place for a break point, because that function is called every time the BookX plugin is inserting something somewhere. For tpl_tabular_display.php it should stop at the "switch" option "NOTIFY_TEMPLATE_PRODUCT_LISTING_TABULAR_DISPLAY_BEGIN" which is the notifier you inserted into tpl_tabular_display.php.

Let's see what all this does for you :)

Regards,
p.

10 Jul 2014, 12:15 PM
#100
dmlyons avatar

dmlyons

New Zenner

Join Date:
Jul 2014
Location:
Boston, MA, USA
Posts:
47
Plugin Contributions:
0

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

philou:

you are right, it's a nice little plug-in, so let's see if we can get it to work for you. To get to the root of the problem, let's calrify this: When you say "nothing happens"
Now when you are listing the category "bookx testing" in your shop, it shows "Bookx Test Product" but in your case no extra book-info like number of pages or ISBN or author etc?

Why do you assume, that "tpl_tabular_display.php" is the problem?

When I say nothing happens, I mean that I can't even get it to install. I put in the http://[YOUR-SHOP-URL]/[YOUR-ADMIN-FOLDER]/?action=bookx_install URL (security being what it is, I don't want to paste it here, of course), and I get a 404 NOT FOUND error. If I name my shop instead of my admin, it just shows me the shop, and if I name my shop AND my admin, as I would to log into the admin, it shows me the log-in page for admin. Doing it precisely as directed gets me a 404. So...nothing. Nothing changes and the module isn't initializing. I've double checked, and all the files are in place, as ordered. Honestly, I'm not sure what I could be missing. Aside from little nits, I've never faced one that simply wouldn't move, so I have to assume I'm doing something wrong. Darned if I know WHAT I'm doing wrong, but something.

And no, I can't get as far as seeing the BookX options in the admin. If I got that far, I would consider it a nit I'm dealing with. So, testing to see if a file is being called won't help, because it's not calling anything right now. Grin...

To be honest, I fixated on the tabular file for only two reasons... The directions for that one weren't all that specific, and DW hated where I was trying to place the code. Shrug. If it doesn't matter, it doesn't, and that's not my problem. Scratch it off the list, I say.

Thanks for your help, though. Hopefully, I can figure out where I'm messing up eventually.

DML