Page 1 of 1

Help to update an addon to 1.0.8.20

Posted: Fri Dec 23, 2022 4:25 pm
by heatherbell
Trying to update the following line to work in 1.0.8.20:

Code: Select all

        $contents[] = ['class' => 'text-center bg-white', 'text' => tep_draw_bootstrap_button(IMAGE_EMAIL, 'fas fa-paper-plane', tep_href_link('recover_carts.php', 'page=' . (int)$_GET['page'] . '&cID=' . $cInfo->customers_id . '&action=email'), null, null, 'btn-warning mr-2') . tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', tep_href_link('recover_carts.php', 'page=' . (int)$_GET['page'] . '&cID=' . $cInfo->customers_id . '&action=delete'), null, null, 'btn-danger')];
Have tried the following without success:

Code: Select all

        $contents[] = ['class' => 'text-center bg-white', 'text' => $Admin->button(IMAGE_EMAIL, 'fas fa-paper-plane', $GLOBALS['Admin']->link('recover_carts.php', 'page=' . (int)$_GET['page'] . '&cID=' . $cInfo->customers_id . '&action=email'), 'btn-warning mr-2') . $Admin->button(IMAGE_DELETE, 'fas fa-trash', $GLOBALS['Admin']->link('recover_carts.php', 'page=' . (int)$_GET['page'] . '&cID=' . $cInfo->customers_id . '&action=delete'), 'btn-danger')];
Any pointer gratefully received.

Re: Help to update an addon to 1.0.8.20

Posted: Fri Dec 23, 2022 5:40 pm
by Kofod95

Code: Select all

 $contents[] = ['class' => 'text-center bg-white', 'text' => $Admin->button(IMAGE_EMAIL, 'fas fa-paper-plane', $GLOBALS['Admin']->link('recover_carts.php', ['page' => (int)$_GET['page'], 'cID' => $cInfo->customers_id, 'action' => 'email']), 'btn-warning mr-2') . $Admin->button(IMAGE_DELETE, 'fas fa-trash', $GLOBALS['Admin']->link('recover_carts.php', ['page' => (int)$_GET['page'], 'cID' => $cInfo->customers_id, 'action' => 'delete']), 'btn-danger')];
?

Parameters have, generally, been cleaned up into arrays

//Daniel

Re: Help to update an addon to 1.0.8.20

Posted: Sat Dec 24, 2022 7:12 am
by heatherbell
Kofod95 wrote: Fri Dec 23, 2022 5:40 pm Parameters have, generally, been cleaned up into arrays
Many thanks, tried that but the same problem exists, that is, that code results in the links for the buttons to be wrong.
That is, the IMAGE_EMAIL, 'fas fa-paper-plane' button shows href="btn-warning mr-2" and the IMAGE_DELETE, 'fas fa-trash' button shows href="btn-danger"
Looked again at core file examples e.g. https://github.com/CE-PhoenixCart/Phoen ... 5D-%3Elink
So then changed the position of the style code so the line is changed to:

Code: Select all

     $contents[] = ['class' => 'text-center bg-white', 'text' => $Admin->button(IMAGE_EMAIL, 'fas fa-paper-plane', 'btn-warning mr-2', $GLOBALS['Admin']->link('recover_carts.php', ['page' => (int)$_GET['page'], 'cID' => $cInfo->customers_id, 'action' => 'email'])) . $Admin->button(IMAGE_DELETE, 'fas fa-trash', 'btn-danger', $GLOBALS['Admin']->link('recover_carts.php', ['page' => (int)$_GET['page'], 'cID' => $cInfo->customers_id, 'action' => 'delete']))];
This seems to be working now.

Re: Help to update an addon to 1.0.8.20

Posted: Sat Dec 24, 2022 7:30 am
by Kofod95
Oh yes, I can never remember the order of what goes where.. I always just copy a core-button (or link, or form or whatever) and rename :lol:
Glad you got it working!

//Daniel

Re: Help to update an addon to 1.0.8.20

Posted: Sat Dec 24, 2022 7:33 am
by heatherbell
Now found another issue, similar problem with this line that is failing to give the right href:

Code: Select all

      $contents[] = ['class' => 'text-center', 'text' => $Admin->button(IMAGE_DELETE, 'fas fa-trash', 'primary', 'btn-danger mr-2') . $Admin->button(IMAGE_CANCEL, 'fas fa-angle-left', 'btn-light', $GLOBALS['Admin']->link('recover_carts.php', ['page'=> (int)$_GET['page'], 'cID' => (int)$cInfo->customers_id]))];
Changed to:

Code: Select all

      $contents[] = ['class' => 'text-center', 'text' => $Admin->button(IMAGE_DELETE, 'fas fa-trash', 'btn-danger mr-2', $GLOBALS['Admin']->link('recover_carts.php', ['page'=> (int)$_GET['page'], 'cID' => (int)$cInfo->customers_id, 'action' => 'deleteconfirm'])) . $Admin->button(IMAGE_CANCEL, 'fas fa-angle-left', 'btn-light', $GLOBALS['Admin']->link('recover_carts.php', ['page'=> (int)$_GET['page'], 'cID' => (int)$cInfo->customers_id]))];
Now seems to be working :D