Hook Addons

Talk about Hooks. Share Hooks you have made.
Post Reply
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Hook Addons

Post by burt »

List of Hook Addons that are solely a Hook File (or a Hook and accompanying Language file).

Please feel free to add a reply as and when you find them.
Free or not. Tell us what it does, tell us where it is.
If you install said hook, feel free to post an image of what it does (assuming it outputs something to the page).


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Hook Addons

Post by burt »

Product Attributes on Listings

https://phoenixcart.org/forum/viewtopic.php?f=39&t=3273

product attributes.JPG

Adds in whatever options you want to show on the Product Cards in listing pages.
Made by @Omar_one and available in the Co-op.
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Hook Addons

Post by burt »

QR Codes on Invoice

https://phoenixcart.org/forum/app.php/a ... n_invoice/

qrddd.jpg

Allows your customer to scan the printed QR code to easily open their Order.
You do not have the required permissions to view the files attached to this post.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Hook Addons

Post by Kofod95 »

Set specials on product edit

app.php/addons/free_addon/set_specials_on_product_edit/
specialsOnEdit.png
Simply adds in a way to set a specials price and date, when editing or creating a product. This means, you don't have to use the dropdown in the core "specials.php", which can be a little inconvenient for stores with many products.

Not yet updated for BS5.
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Hook Addons

Post by burt »

Here's one from @bonbec showing the user what they already have in their cart prominently.

attributes2.jpg

viewtopic.php?f=39&t=2755
You do not have the required permissions to view the files attached to this post.
I am not here to build for you.
I am here to build with you. Let's help each other.
Dan Cole
Senior Contributor
Posts: 498
Joined: Fri Oct 25, 2019 2:14 pm
Phoenix Version: 1.0.8.21
Has thanked: 67 times
Been thanked: 61 times

Re: Hook Addons

Post by Dan Cole »

This hook adds the search and go to input boxes back to the categories/products page. I didn't like the search icon that was added to this page and resulted in an extra click. The hook also sets the search field active so you can search for an item without having to click on it either. This image shows exactly what it does.

Category_Inputs.jpg

and here is the hook. It was created with help from my code monkey Gemini.

Code: Select all

<?php
class hook_admin_catalog_catalogAutoExpandSearch {

  public function listen_injectSiteStart() {
    ob_start(function($buffer) {
      // 1. Expand the search row permanently & add bottom margin (mb-2)
      $buffer = str_replace(
        'class="collapse row" id="collapseSearch"', 
        'class="row mb-2" id="collapseSearch"', 
        $buffer
      );
      
      $buffer = str_replace(
        'id="collapseSearch" class="collapse row"', 
        'id="collapseSearch" class="row mb-2"', 
        $buffer
      );

      // 2. Remove the search toggle button from the top bar
      $buffer = preg_replace('/<(a|button)[^>]*data-bs-target="#collapseSearch"[^>]*>.*?<\/\1>/s', '', $buffer);

      // 3. Inject script to focus the search input automatically on load
      $focusScript = <<<HTML
<script>
  document.addEventListener('DOMContentLoaded', function() {
    var searchInput = document.querySelector('#collapseSearch input[name="search"]');
    if (searchInput) {
      searchInput.focus();
    }
  });
</script>
HTML;

      // Append the focus script right before the closing body tag
      return str_replace('</body>', $focusScript . '</body>', $buffer);
    });
  }
}
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Hook Addons

Post by burt »

Hook to allow Shopowner to easily find/copy a products Anywhere HTML element from the Admin.

https://github.com/CE-PhoenixCart/Produ ... 7c67ed0005
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply