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 201 to 220 of 427
2 Nov 2014, 1:15 PM
#201
philou avatar

philou

Zen Follower

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

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

Hi mesnitu,

the MySQL error is a bug indeed. You can fix it as follows:
In file [YOUR_ZC_INSTALLATION] -> includes -> functions -> extra_functions -> functions_product_type_bookx.php
on lines 253 & 254 (this is the "publisher" filter query)
you need to replace "bi" with "bpub" so it looks like this:

$extra_filter_query_parts['join']['publisher'] = ' LEFT JOIN ' . TABLE_PRODUCT_BOOKX_PUBLISHERS . ' bpub ON bpub.bookx_publisher_id = be.bookx_publisher_id ';
$extra_filter_query_parts['where']['publisher'] = ' bpub.bookx_publisher_id = "' . $active_bx_filter_ids['publisher_id'] . '" ';

Let me know if that solves the error for you and I will include this in another revision update asap.

As for resetting the filter, I don't yet see what your usage scenario is. I have tested it here with multiple BookX filters enabled and if I filter for genre "A" and then reset, I return to the homepage. Do you get this behaviour and do you agree that this is a good way to do it?

If I filter for genre "B" and then filter for series "XYZ" (a series which had genre "B" applied, otherwise I could not choose it from the filter popup) and then I reset the genre filter, I still get the series "XYZ" displayed, for which i was also filtering. Do you get this behaviour and do you agree that this is a good way to do it?

If we are speaking of different things, then please try again to explain again what your scenario is :)

Regards,
p.

2 Nov 2014, 6:26 PM
#202
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Hi
The query change did the trick :) Thank's !
Also, now I'm using r4 .

About the reset , I think it's a template issue. As I said , this template uses new, featured and special products in a jquery tab. I also have a slider above.
So when I reset the filter (total reset), it breaks the template or the querys that the template needs to do in the homepage.

But , one thing I notice, it's upon the total reset, I get a breadcrumb Home :: genre_description , and in my homepage I don't have a breadcrumb, and the sliders and tabs only work in the homepage because they have a if ($is_home)

Am I really on the hompage ?

If I filter for genre "B" and then filter for series "XYZ" (a series which had genre "B" applied, otherwise I could not choose it from the filter popup) and then I reset the genre filter, I still get the series "XYZ" displayed, for which i was also filtering. Do you get this behaviour and do you agree that this is a good way to do it?

It's just awsome ! :smile:

Thanks !

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

2 Nov 2014, 6:46 PM
#203
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 mesnitu,

difficult for me to troubleshoot your template issue. I am aware that the breadcrumbs do not yet give meaningful "Bookx" info all the time, especially when navigating around after a filter or search. This will hopefully work better soon, like in 0.9.5.

The filters work exclusively via the GET parameters added to the URL. You can try this by hand, by adding something like &typefilter=bookx&bookx_genre_id=2 at the end of your URL and voilá: you have filtered for genre with ID #2. Now if your template also uses GET parameters for whatever reason, it could be that they are cut off when you reset the filter? Just look at your URL when your template is working and compare to when it isn't working. As far as the filters are concerned that is the only place where it can interfere in my opinion.

I think ZC assumes that if there are GET parameters in the URL, you are not on the homepage. Try deleting the bookx parameters and see if it behaves like the homepage then.

Regards,
P.

2 Nov 2014, 7:20 PM
#204
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Hi
When I reset the filter I get this url :
index.php?main_page=index&typefilter=bookx&bookx_publisher_id=

But if I could get this :
index.php?main_page=index

it would be ok .

By the way : what are the options in the configuration of the filter ?, it says :

Filter list: Size/Style
Sets the maximum length for an option list in the Book X filter sidebox. Settings this value to 0 or 1 will display a dropdown list.

Thanks

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

2 Nov 2014, 7:24 PM
#205
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

oh I get it , if we place a 3 in the Filter list: Size/Style it gets a select form !

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

2 Nov 2014, 8:23 PM
#206
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

Fixing the "filter reset" needed more changes than just one line, so find attached the updated file bookx_filters.php to go into [YOUR_ZC_INSTALLATION] -> includes -> index_filters ->

Let me know if that works for you and I'll have it in the next update.
p.

Attachment #14649

2 Nov 2014, 8:51 PM
#207
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Hi Philou ! :bow:
Fantastic man !
Thanks a lot !

Are you developing this module for some university project or something ? This is quite amazing, and the support and effort outstanding !
Thanks !

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

2 Nov 2014, 9:10 PM
#208
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 mesnitu,

thank you for your kind words! I am developing this for our own store, which is actually not a bookstore but the shop of a small publisher. This may be why some things work like someone using them day to day would like to have them work...
The reason I can respond so quickly just now is, that I happen to work on this project anyway at this very moment. If someone finds a bug I may just as well fix that first before I tackle the ones you haven't discovered yet ;)
The workweek is usually full of publishing business, so BookX has to happen on the weekends.

It would be great, if BookX could finally come out of BETA and we could go online with this in our own store by the end of the year, but it's getting tight. Over the years I have already hacked a few versions of ZenCart for our bookselling purposes, but this time I wanted to do it right and write a proper plugin. I did underestimate a bit the time it takes to pass this on to others so it is useful, with a little documentation, allowing configuartion via ADMIN, adding langugage files etc etc.

Anyway, glad it is useful for some other people too!

Regards,
p.

2 Nov 2014, 9:35 PM
#209
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Well, can't thank you enough !

I will make some suggestions as I working with the module, however, please consider them as suggestions and not asking for more features, because as I see it , bookx it's already a great tool for bookshops.

Thanks!

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

4 Nov 2014, 10:08 AM
#210
redransom avatar

redransom

New Zenner

Join Date:
Aug 2014
Posts:
20
Plugin Contributions:
0

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

philou:

Hi Mesnitu,

very difficult to say what the problem is with so little info. Are you sure there is no DEBUG log anywhere? Check this post about where to look for it: http://www.zen-cart.com/content.php?124-blank-page. The DENUG log should give some valuable info about what exactly is going wrong.

Regards,
p.

Hi Philou,

Yes it did fix my problem. I have come across other issues since but they are probably down to other templating issues. I've got other projects on the go so I've been on and off this shop for the last couple of weeks.

Looking forward to the next release so I can play with the filtering on author types :-)

Kinsley

4 Nov 2014, 10:11 AM
#211
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 Kinsley,

glad you could resolve your problem. Filters are fully operational as far as I'm concerned…?

Best regards,
p.

4 Nov 2014, 11:42 AM
#212
redransom avatar

redransom

New Zenner

Join Date:
Aug 2014
Posts:
20
Plugin Contributions:
0

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

Hah oh dear - this is driving me daft.

OK you are right filters is there - except that on an update it is breaking out before it gets to the 0.9.3 section. I have just checked the 0.9.4 zip file and in the init_product_type_bookx.php file on line 623 it has a break; command.

So, taking that out has installed the filter options etc from 0.9.3.

Unfortunately I can't figure out how to have filter by author type? Both Illustrator and Authors are shown in the same Authors drop down - is this by design?

Thanks,

Kinsley

4 Nov 2014, 12:01 PM
#213
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

Goodness, you are right, that break; on line 623 of the installation script from 0.9.2 to 0.9.4 should not be there.

Did you set "Allow multiple filters" to "true" in ADMIN -> Catalog -> Product Types -> Product Type BookX -> edit layout ?

4 Nov 2014, 12:20 PM
#214
redransom avatar

redransom

New Zenner

Join Date:
Aug 2014
Posts:
20
Plugin Contributions:
0

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

Hi Philou,

Yes I've enabled the Filter author type and also the Allow multiple filters active.

Kinsley

4 Nov 2014, 12:45 PM
#215
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

Hm, i don't quite see what is going wrong.

Just to be sure:
in ADMIN -> Catalog -> Product Types -> Product Type BookX -> edit layout you have two settings:

Filter Sidebox - Filter Autor
Filter Sidebox - Filter Author Type

Both are set to "1", yes?
Of course you also have at least one author and at least one author type set up and you also have at least one product with this author and that type?

If all this is the case, can you go to ADMIN -> Tools -> Developer Tool Kit and look for this constant: SHOW_PRODUCT_BOOKX_FILTER_AUTHOR_TYPE
Does it find it? If yes, then it really beats me what is going on.

Finally, do you have the possibility to debug the code i.e. set breakpoints or is that a bit above what you are comfortable with? The logic to show the author type filter dropdown is in [YOUR_ZC_INSTALLATION]/includes/modules/sideboxes/bookx_filters.php around line 71. I don't have much I can debug here, since it is working for me. I would first have to be able to reproduce the error.

Have you tried to use the RESET Bookx option new in 0.9.4r4 to be found in ADMIN -> Tools -> BookX Tools -> Reset settings? Make a DB backup first !!
This makes sure all the settings constants etc. are in the DB, but it also resets their values, notable ALLOW_ MULTIPLE_FILTERS to "0" = no.

Regards,
p.

4 Nov 2014, 2:16 PM
#216
redransom avatar

redransom

New Zenner

Join Date:
Aug 2014
Posts:
20
Plugin Contributions:
0

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

Bl**dy hell - ok I figured out what the problem was - and again it wasn't your fault.

The previous developer copied the file into the bespoke template folder and it was an older version of the filter code.

I deleted that and guess what - it works now as it uses the template default version.

Gee sorry to have wasted your time Philou.

Kinsley

4 Nov 2014, 2:29 PM
#217
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

Guess you're not called redrandsom for nothing ;)
At least it wasn't a fault in my code, and you spotted the bug in the install script, so that's good.

Regards,
p.

8 Nov 2014, 7:27 PM
#218
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

Hi there
Sometime I see this message :
This book is not currently displayed in your shop, since the "product status" is set to

Everything is working fine, but there is this message .

Thanks

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

8 Nov 2014, 7:37 PM
#219
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 mesnitu,

it should read This book is not currently displayed in your shop, since the "product status" is set to "Out of stock".

It will be fixed in next release. If it bothers you then change line 35 of [ADMIN] –> includes -> languages -> english (or portugese :) ) -> product_bookx.php

to

define('TEXT_PRODUCT_NOT_DISPLAYED_DUE_TO_PRODUCT_STATUS', 'This book is not currently displayed in your shop, since the "product status" is set to "Out of stock".');

Regards,
p.

8 Nov 2014, 8:58 PM
#220
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

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

hi
ok, but I forgot to mentioned , that this message it's when I about to insert a new product.... so there is no product or stock.

Thanks

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison