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

Results 341 to 360 of 427
3 Feb 2016, 9:15 AM
#341
digibooks avatar

digibooks

Zen Follower

Join Date:
May 2014
Location:
UK
Posts:
317
Plugin Contributions:
0

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

DigiBooks:

In the bottom left-link of the screen it is showing correctly but linking me to www.facebook.com%2ajcarella so it looks like the the last forward slash is being interpreted as a space character (although I would have thought that to be %20) not sure what %2 is.

The link works fine as long as it it just a basic domain link - the problem is when you enter forward slashes into the address.

3 Feb 2016, 10:22 AM
#342
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

DigiBooks:

The link works fine as long as it it just a basic domain link - the problem is when you enter forward slashes into the address.

I see the same issue....
Something with the urlencode:

$current_author['url'] = (!empty($authors->fields['author_url']) ? zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($authors->fields['author_url']), 'NONSSL', true, false) : '');

Makes a %2

$current_author['url'] = (!empty($authors->fields['author_url']) ? zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . ($authors->fields['author_url']), 'NONSSL', true, false) : '');

Works fine....

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

3 Feb 2016, 10:46 AM
#343
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

mesnitu:

I see the same issue....
Makes a %2

Actually, for me makes a %2F... so it should be ok... but it's not.

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

3 Feb 2016, 10:48 AM
#344
digibooks avatar

digibooks

Zen Follower

Join Date:
May 2014
Location:
UK
Posts:
317
Plugin Contributions:
0

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

mesnitu:

I see the same issue....
Something with the urlencode:

$current_author['url'] = (!empty($authors->fields['author_url']) ? zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($authors->fields['author_url']), 'NONSSL', true, false) : '');

Makes a %2

$current_author['url'] = (!empty($authors->fields['author_url']) ? zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . ($authors->fields['author_url']), 'NONSSL', true, false) : '');

Works fine....

Thanks - that code has changed in Release 8 which was given to me yesterday to make it work with v1.5.4:

$current_author['url'] = (!empty($authors->fields['author_url']) ? (strpos($authors->fields['author_url'], 'http') ? urlencode($authors->fields['author_url']) : 'http://' . urlencode($authors->fields['author_url'])) : '');

Do I have to remove both instances of urlencode ???

3 Feb 2016, 10:55 AM
#345
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

DigiBooks:

Do I have to remove both instances of urlencode ???

I haven't tested the new code. Is it working now ?

I was just mentioning what I've seen.
It's better to wait for Philou update.

Best Regards

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

3 Feb 2016, 11:04 AM
#346
digibooks avatar

digibooks

Zen Follower

Join Date:
May 2014
Location:
UK
Posts:
317
Plugin Contributions:
0

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

mesnitu:

I haven't tested the new code. Is it working now ?

I was just mentioning what I've seen.
It's better to wait for Philou update.

Best Regards

No worries. The code was changed because something had happened since v1.5.1 and the redirect just returned zen-cart's index page. With the change in Release 8 it is working provided there are no forward slashes in the url.

3 Feb 2016, 3:35 PM
#347
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 guys,

sorry, my bad. Indeed the urlencode makes no sense in that part of the code. I have uploaded another archive to sourceforge (still called "revision8") where these two files have been once more changed to remove the urlencode:

ZEN-CART/includes/modules/pages/product_bookx_info/main_template_vars_product_type.php
ZEN-CART/includes/classes/observers/class.bookx_observers.php

Tested it here and it works also with forward slash.

Regards,
p.

3 Feb 2016, 3:48 PM
#348
digibooks avatar

digibooks

Zen Follower

Join Date:
May 2014
Location:
UK
Posts:
317
Plugin Contributions:
0

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

philou:

Hi guys,

sorry, my bad. Indeed the urlencode makes no sense in that part of the code. I have uploaded another archive to sourceforge (still called "revision8") where these two files have been once more changed to remove the urlencode:

ZEN-CART/includes/modules/pages/product_bookx_info/main_template_vars_product_type.php
ZEN-CART/includes/classes/observers/class.bookx_observers.php

Tested it here and it works also with forward slash.

Regards,
p.

Sweet!!! Thank you so much :)

I will continue to play around with the system now so will let you know how it all goes

3 Feb 2016, 3:49 PM
#349
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 to download the revision8 , but , those files also take care of publishers url ?

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

3 Feb 2016, 10:47 PM
#350
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

Yes, the author URLs and publisher URLs should both be fixed.

regards,
p.

29 Feb 2016, 7:10 PM
#351
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
I'm on a my dev machine with zen 154, and I see now that inserting a product bookx is not adding the date_added in the products table.
I've check the online shop, and I have that field filled, but I can reach a conclusion because:
first - it's a zen 151 and the bookx module it's also different.
Second - I actually upload the files as general product and convert them later.

Can you confirm this, checking you database ?

Thanks
Best Regards

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

29 Feb 2016, 7:40 PM
#352
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,

can you verify, whether the newly inserted products have a "date_added" before you convert them to product type Bookx ?
"Date_added" shouldn't be touched by Bookx really. BookX just adds an extra table for the info that is not included in product type "general".

Regards,
p.

29 Feb 2016, 7:55 PM
#353
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

philou:

Hi mesnitu,

can you verify, whether the newly inserted products have a "date_added" before you convert them to product type Bookx ?
"Date_added" shouldn't be touched by Bookx really. BookX just adds an extra table for the info that is not included in product type "general".

Regards,
p.

Yes, and if I convert them to bookx, the products_date_added remains with that date.

inserting a bookx product type, doesn't ( at least here )

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

29 Feb 2016, 8:02 PM
#354
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

And after the conversion to bookx, if I change something in that book, the products_last_modified gets data.

I've seen this now, because I was working on the ep4 export and all I got was 0000.

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

29 Feb 2016, 8:30 PM
#355
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

Just imserted a product of type BookX and the products_date_added seems fine.
This is done via the MySQL command "now()", maybe your database doesn't play along?

This happens in file: [ZENCART]/[YOUR_ADMIN]/includes/modules/product_bookx/update_product.php around line 81

$insert_sql_data = array( 'products_date_added' => 'now()',
                                'master_categories_id' => (int)$current_category_id);

You could try and put in there:

$'products_date_added' => '2001-01-01'

and see if a newly created product has this date in the database. If no, then there's indeed a problem in the script. If yes, I suspect som time problem with your local webserver or MySQL.

Regards,
p.

29 Feb 2016, 8:51 PM
#356
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, sorry about that Philou
I've made the two inserts with a defined date and with now() .... and both were inserted ok :lamo:

That's why I wanted to confirm, because I'm messing around a lot with this database with imports / exports, something has gone wrong... or I'm going crazy

Sorry for wasting your time !
Thanks
Best Regards

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

29 Feb 2016, 8:57 PM
#357
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

Ok. Whatever you do, don't go crazy ;)

29 Feb 2016, 9:05 PM
#358
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

:thumbsup:

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

26 Mar 2016, 12:59 PM
#359
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
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)**
> 
> ```php
// 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
 <?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 
> 
> ```php
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 > > ```php 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 > > ```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.

First let me thank you very, very much for easy populate/bookx plugin!  Installed and working without a glitch.  using Easy Populate 4.0.33a - Beta 02-29-2016 w/ BookX0.9.9

I know it has been some time since I tried to implement the ceon URI mods you stated above but I could never get it to work as intended.  Could you provide some help at this time?  My setup:
Zen Cart 1.54
Responsive_sheffield_blue v2.0 template
Bookx version 0.9.4 r8
PHP Version 5.3.29

When I tried to implement the changes you outlined above, I got the ceon uri code at the top of the collect_info page and could not get any further, and of course no ceon box at the bottom of the page, so could we start there if you have the time.  There were other problems but I thought if I could get the collect_info.php working I might be able to figure out the other pages and maybe  the metatags problems also.

Best regards,

Frank
26 Mar 2016, 1:20 PM
#360
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 Frank,

menitu must respond to you, since he wrote the original post.
Let me just point out again, that there is an inclusion mechanism, which allows you to place a file which begins with "collect_info" like "collect_info_ceon_uri.php" and it will be included automatically by "collect_info.php". The same must then be implemented for "preview_info" and "update_product", so you deal with all your extra data in all three files and leave the original files untouched (if possible).

Regards,
p.