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,146

Results 301 to 320 of 427
23 Aug 2015, 6:16 PM
#301
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

You can find an updated module here: https://sourceforge.net/projects/zencartbookx/files/?source=navbar
Please note that I have simply removed the requirement for tpl_modules_whats_new.php since there is currently no Bookx modification in there.

Regards,
p.

23 Aug 2015, 6:22 PM
#302
fjbern1943 avatar

fjbern1943

Zen Follower

Join Date:
Apr 2015
Location:
United States
Posts:
144
Plugin Contributions:
0

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

Thank You. I downloaded the new plugin version. Now I will try to do the file mods in the Edit Manually Directory in my test site.

Thanks again, I will let you know how I make out after the I try the complete installation.

25 Aug 2015, 1:55 PM
#303
fjbern1943 avatar

fjbern1943

Zen Follower

Join Date:
Apr 2015
Location:
United States
Posts:
144
Plugin Contributions:
0

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

Bookx plugin installed perfectly and all files and modified files are on the live site and it seems to be working fine.

I guess I didn't realize this but since I added a different product type my other plugins do not work with the new product type (bookx). Now I need to find someone to expand my CEON URI, Vendor Shipping with PDF and Easypopulate plugins. I don't think I am capable of doing this myself. If you are interested in tackling this or know of someone who would be interested, please PM me.

25 Aug 2015, 2:07 PM
#304
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 fjbern,

glad it works as advertised finally!
I suspect the first two plugins you mention are easier to get to work with BookX, but "Easy populate" is a different animal. Another member has asked me about this a few posts below, and it is not such a trivial task.

I myself am more focussed on getting BookX out of BETA as there are still a few bits which I would like to get working first. So short answer is: as it looks now i will not tackle the Easy Populate functionality in the near future.

Best regards,
p.

25 Aug 2015, 3:46 PM
#305
fjbern1943 avatar

fjbern1943

Zen Follower

Join Date:
Apr 2015
Location:
United States
Posts:
144
Plugin Contributions:
0

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

mesnitu:

Hi
I'm having a issue, probably not related to the module itself , but I can't seen to get this working.

I'm using tabs to display new, featured and special in the main page.
For some reason when I make the necessary changes to the file new_products.php , all I get it's a blank in the news product tab.

The featured and special are ok, just the new product.
If I comment again the 3 alterations made in that file, everything it's ok , but of course no new bookx products comes up...
If I go to main_page=products_new the bookx products are there....

Thanks

By the way , did anyone already used the bookx modules with the ceon_uri mapping ?

Hello, Did you ever get an answer about using bookx and ceon URI mapping together?

25 Aug 2015, 3:50 PM
#306
fjbern1943 avatar

fjbern1943

Zen Follower

Join Date:
Apr 2015
Location:
United States
Posts:
144
Plugin Contributions:
0

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

Of the three plugins I mentioned I would have thought that the easypopulate one would be the easiest. I think you can just add custom datafields in the easy populate admin. The CEON URI looks like a bear! Anyone out there integrated CEON URI WITH Bookx I would like to hear from you.

1 Sep 2015, 5:37 PM
#307
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
You can. I'm not sure if I can guide you, cause it has been a while since I did that, but look at :
admin/includes/modules/product_bookx/ and compare with the normal product.
The files are this ones:

collect_info.php
copy_to_confirm.php
delete_product_confirm.php
preview_info.php
update_product.php

Ex: For the update , I have a include file, because bookx looks for a additional update_product*.php around line 380 ( I have 0.9.4-revision4 of bookx), but in others I dont', because I became aware of that latter. So see if you can take advantage of that.

//** look for additional update_product*.php files and include now **//
    $incl_dir = @dir(DIR_FS_ADMIN . '/includes/modules/product_bookx');
    while ($file = $incl_dir->read()) {
    	if ('update_product_' == substr($file, 0, 15)) {
    		include_once DIR_FS_ADMIN . '/includes/modules/product_bookx/' . $file; // This should handle any extra values collected in collect_info*.php
    	}
    }
    $incl_dir->close();

So I created a update_product_seo.php that has ( in the same folder)

// BEGIN CEON URI MAPPING 1 of 1
    require_once(DIR_WS_CLASSES . 'class.CeonURIMappingAdminProductPages.php');
    
    $ceon_uri_mapping_admin = new CeonURIMappingAdminProductPages();
    
    $ceon_uri_mapping_admin->updateProductHandler($products_id, $zc_products->get_handler($product_type));
    
    // END CEON URI MAPPING 1 of 1

For the collect_info.php same thing, created a collect_info_seo.php,

    // BEGIN CEON URI MAPPING 1 of 2
    require_once(DIR_WS_CLASSES . 'class.CeonURIMappingAdminProductPages.php');
    
    $ceon_uri_mapping_admin = new CeonURIMappingAdminProductPages();
    
    $ceon_uri_mapping_admin->collectInfoHandler();
    
    // END CEON URI MAPPING 1 of 2

**and around line 1158 **

 <?php if (isset($extra_html_end)) echo $extra_html_end; // this was possibly filled by an included file above ?>
<?php // BEGIN CEON URI MAPPING 2 of 2
       echo $ceon_uri_mapping_admin->collectInfoBuildURIMappingFields();
// END CEON URI MAPPING 2 of 2 ?>

In the preview_info.php , it's diferent (don't ask me why)
Around line 84 you'll see :

foreach ($bookx_author_ids as $key => $author_id) {
      		$pInfo->authors_display .= (!empty($pInfo->authors_display) ? ' | ' : '') . ($bookx_author_type_ids ? bookx_get_author_type_description($bookx_author_type_ids[$key], (int)$_SESSION['languages_id']) . ': ' : '') . bookx_get_author_name($author_id);
      	}
      }
// BEGIN CEON URI MAPPING 1 of 4
      require_once(DIR_WS_CLASSES . 'class.CeonURIMappingAdminProductPages.php');
      
      $ceon_uri_mapping_admin = new CeonURIMappingAdminProductPages();
      
      $ceon_uri_mapping_admin->productPreviewProcessSubmission($current_category_id);
      
      // END CEON URI MAPPING 1 of 4
      
      
    } else {

Around line 146

while (!$genres->EOF) {
      	$pInfo->genres_display .= (!empty($pInfo->genres_display) ? ' | ' : '') . $genres->fields['genre_description'];
      	$genres->MoveNext();
      }
      
      // BEGIN CEON URI MAPPING 2 of 4
      require_once(DIR_WS_CLASSES . 'class.CeonURIMappingAdminProductPages.php');
      
      $ceon_uri_mapping_admin = new CeonURIMappingAdminProductPages();
      
      $ceon_uri_mapping_admin->productPreviewInitialLoad((int) $_GET['pID'],
        $zc_products->get_handler((int) $_GET['product_type']));
      
      // END CEON URI MAPPING 2 of 4

    }

Line 274

<tr>
        <td class="main"><?php echo sprintf(TEXT_PRODUCT_MORE_INFORMATION, $pInfo->products_url); ?></td>
      </tr>
<?php
      }
?>
      <?php // BEGIN CEON URI MAPPING 3 of 4
      $ceon_uri_mapping_admin->productPreviewOutputURIMappingInfo($languages[$i]);
      // END CEON URI MAPPING 3 of 4 ?>
      <tr>
        <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>

Around 353

echo ( (isset($_GET['search']) && !empty($_GET['search'])) ? zen_draw_hidden_field('search', $_GET['search']) : '') . ( (isset($_POST['search']) && !empty($_POST['search']) && empty($_GET['search'])) ? zen_draw_hidden_field('search', $_POST['search']) : '');
      // BEGIN CEON URI MAPPING 4 of 4
      echo $ceon_uri_mapping_admin->productPreviewBuildHiddenFields();
// END CEON URI MAPPING 4 of 4
      echo zen_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '  ';

copy_to_confirm.php

if ($_POST['copy_discounts'] == 'copy_discounts_yes') {
              zen_copy_discounts_to_product($old_products_id, (int)$dup_products_id);
            }

            // BEGIN CEON URI MAPPING 1 of 1
            require_once(DIR_WS_CLASSES . 'class.CeonURIMappingAdminProductPages.php');
            
            $ceon_uri_mapping_admin = new CeonURIMappingAdminProductPages();
            
            $ceon_uri_mapping_admin->copyToConfirmHandler($products_id_from, $products_id_to,
              $product->fields['products_type'], $zc_products->get_handler($product->fields['products_type']),
              $categories_id);
            
            // END CEON URI MAPPING 1 of 1

But I also have the metatags ( not entirely working ), so in this folder I have

collect_info_metatags.php
collect_info_seo.php
delete_product_confirm.php
preview_info.php
update_product_seo.php
collect_info.php
copy_to_confirm.php
preview_info_meta_tags.php
update_product.php

I don't remember changing anything in meta_tags files. I think I just copy from modules/product
Note: Metatags are working as normal product, but as I remember without them, I couldn't had any metatags at all.
This is what I remember.... hope it can guide you.

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

1 Sep 2015, 5:51 PM
#308
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

mesnitu:

In the preview_info.php , it's diferent (don't ask me why)

You can also put a file that starts with preview_info and ends with ".php" and it will be included, but further down in the script, so all variables from the POST are available.

Line 144:

    //** look for additional preview_info*.php files and include now **//
    $incl_dir = @dir(DIR_FS_ADMIN . '/includes/modules/product_bookx');
    while ($file = $incl_dir->read()) {
    	if ('preview_info_' == substr($file, 0, 13)) {
    		include_once DIR_FS_ADMIN . '/includes/modules/product_bookx/' . $file; // This should handle any extra values collected in collect_info*.php
    	}
    }
    $incl_dir->close();

So if you put a file "preview_info_myextrainfo.php" in the same folder, it gets included.

Regards,
p.

1 Sep 2015, 7:11 PM
#309
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

I'm trying to install the latest bookx release with zencart 1.54
I just have this installed.

I dont' see anyone reporting this....so I guess some data base config ?

[01-Sep-2015 19:03:14 UTC] PHP Fatal error:  1366:Incorrect integer value: '' for column 'type_sort_order' at row 1 :: insert into product_bookx_author_types (type_sort_order) values ('') ==> (as called by) /home/daniel/public_html/zen154.dev/zencc/includes/functions/database.php on line 53 <== in /home/daniel/public_html/zen154.dev/includes/classes/db/mysql/query_factory.php on line 155

I also had this issue installing zencart, but there was a fix saying (This is ONLY necessary if you're getting this specific error, and have STRICT_ALL_TABLES enabled in MySQL.)

[01-Sep-2015 18:23:18 UTC] PHP Fatal error:  1101:BLOB/TEXT column 'logmessage' can't have a default value :: ALTER TABLE admin_activity_log ADD COLUMN logmessage mediumtext NOT NULL default '' ==> (as called by) /home/daniel/public_html/zen154.dev/zencc/includes/classes/class.admin.zcObserverLogWriterDatabase.php on line 90 <== in /home/daniel/public_html/zen154.dev/includes/classes/db/mysql/query_factory.php on line 155

Thanks

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

1 Sep 2015, 8:11 PM
#310
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

Are you getting this error when inserting a new author type?
If so, are you entering a (numerical) value in the field "sort order"?

If you are getting this error when you insert new author type without entering a sort order then please try entering a value (even zero 0 is fine) and tell me if you still get the error?

thx,
p.

2 Sep 2015, 4:37 AM
#311
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
It was the mysql config that was causing this issue.
I had troubles installing zencart , I had to apply this fix:
https://www.zen-cart.com/showthread.php?215694-Known-Bugs-%28and-fixes%29-with-v1-5-4&p=1268657#post1268657

It seems that with sql_mode=STRICT_TRANS_TABLES, you can't insert authors and authors types ( didn't test the others fields)
So today I changed to
sql_mode=NO_ENGINE_SUBSTITUTION

Usually I'm on Nginx with the same db, but never saw this error in other scritps. But for zencart I've used xampp, that had it's own db. I've change to a lamp cause I'm on linux, and this errors stared to come up.
everything it's ok :)

Thanks

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

2 Sep 2015, 8:28 AM
#312
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

Thanks for letting me know, this is all new to me, I will look into it to see, if it's something I can fix in BookX.

Best regards,
p.

6 Sep 2015, 5:27 PM
#313
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
I'm working on bookx EP import, but I'm getting a lot of this warnings in the log:

PHP Warning: Invalid argument supplied for foreach() in /home/daniel/public_html/zen154.dev/zenadmin/includes/modules/product_bookx/collect_info.php on line 782

As I have SEO uri, possibly the line is different , but I didn't mess with this lines:
It's just a warning, I don't see no working issues, but I wonder what could it be ?
No one else getting this warning ?

foreach ($product_assigned_authors as $product_assigned_author) {
						  echo '<div class="drop_down_div">';
						  echo zen_draw_hidden_field('assigned_author_db_id[' . $author_counter . ']', $product_assigned_author['primary_id']);
						  echo TEXT_PRODUCTS_BOOKX_AUTHOR . ' ' . zen_draw_pull_down_menu('bookx_author_id[' . $author_counter . ']', $authors_array, $product_assigned_author['bookx_author_id']);
						  if (1 < count($author_types_array)) {
							  echo TEXT_PRODUCTS_BOOKX_AUTHOR_TYPE . ' ' . zen_draw_pull_down_menu('bookx_author_type_id[' . $author_counter . ']', $author_types_array, $product_assigned_author['bookx_author_type_id']);
						  };
						  echo '</div>';
						  $author_counter++;
					    }

Thanks

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

6 Sep 2015, 5:51 PM
#314
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

Actually I didn't , but I got around with other price range boxes that I made, so I'm satisfied with the front page.

Best regards

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

6 Sep 2015, 5:54 PM
#315
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

fjbern1943:

Hello, Did you ever get an answer about using bookx and ceon URI mapping together?

Actually I didn't , but I got around with other price range boxes that I made, so I'm satisfied with the front page.

Well, this was the answer to this.... but I dont' get how this quick reply works :blink:
https://www.zen-cart.com/showthread.php?200560-Creating-an-add-on-quot-product-type-book-quot-for-ZC-1-5&p=1290626#post1290626

Best regards

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

6 Sep 2015, 6:09 PM
#316
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

mesnitu:

Hi
I'm working on bookx EP import, but I'm getting a lot of this warnings in the log:

PHP Warning: Invalid argument supplied for foreach() in /home/daniel/public_html/zen154.dev/zenadmin/includes/modules/product_bookx/collect_info.php on line 782

As I have SEO uri, possibly the line is different , but I didn't mess with this lines:
It's just a warning, I don't see no working issues, but I wonder what could it be ?
No one else getting this warning ?

foreach ($product_assigned_authors as $product_assigned_author) {
echo '<div class="drop_down_div">';
echo zen_draw_hidden_field('assigned_author_db_id[' . $author_counter . ']', $product_assigned_author['primary_id']);
echo TEXT_PRODUCTS_BOOKX_AUTHOR . '##' . zen_draw_pull_down_menu('bookx_author_id[' . $author_counter . ']', $authors_array, $product_assigned_author['bookx_author_id']);
if (1 < count($author_types_array)) {
echo TEXT_PRODUCTS_BOOKX_AUTHOR_TYPE . '##' . zen_draw_pull_down_menu('bookx_author_type_id[' . $author_counter . ']', $author_types_array, $product_assigned_author['bookx_author_type_id']);
};
echo '</div>';
$author_counter++;
}

> 
> Thanks

Not sure what the issue could be. In the unmodified collect_info.php an empty array is created on line 100:

$product_assigned_authors = array();


then possibly it is filled with some content on lines 139 and 169:

$product_assigned_authors[] = array('primary_id' => $assigned_authors->fields['primary_id'], 'bookx_author_id' => $assigned_authors->fields['bookx_author_id'], 'bookx_author_type_id' => $assigned_authors->fields['bookx_author_type_id']);

$product_assigned_authors[] = array('primary_id' => '', 'bookx_author_id' => $author_id, 'bookx_author_type_id' => $bookx_author_type_id);


So far it has always been safe to pass an empty array to a foreach loop, so not sure what the Warning is relating to.

foreach ($product_assigned_authors as $product_assigned_author) {


Have you made any changes like IF blocks, that prevent line 100 from creating the empty array?

Regards,
p.
6 Sep 2015, 6:10 PM
#317
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

Sorry
Actually, I'm working only with bookx rc6 and zencart 1.54 ... no mods, no nothing

Best regards

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

6 Sep 2015, 6:13 PM
#318
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

I have that line in 132 , bellow :

$assigned_authors = $db->Execute('SELECT * FROM ' . TABLE_PRODUCT_BOOKX_AUTHORS_TO_PRODUCTS . ' WHERE products_id = ' . $pID);
$product_assigned_authors = array();

Have you made any updates lately ?

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

6 Sep 2015, 6:18 PM
#319
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

Indeed, you are missing these two lines on line 100:

$product_assigned_authors = array();
$product_assigned_genres = array();

It is true I had not included the very latest files in 1.9.4 revisoin 6 since some more files have changed on the way to next version. Just the Fatal Error which fjbern got while installing Bookx.

So add those two lines, the error should go away and then when the next version comes along they will be included :)

Regards,
p.

6 Sep 2015, 6:23 PM
#320
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

Thanks

I was checking the rc 4, and those two lines were there.
ok. Thanks

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