Add width and Height parameter to newwindow

Open to all! Ask other shopowners for help.
Post Reply
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Add width and Height parameter to newwindow

Post by radhavallabh »

Hi all;
I need open the link in new window with width and height defined to it.
Currently it opens in a new tab and no new small window as desired.

Code: Select all

  <?php echo $Admin->button(TEXT_ADD_NEW_PRODUCT,'', 'btn-light', $Admin->link('edit_orders_add_product.php')->set_parameter('oID', $_GET['oID']), ['newwindow' => true]); ?>
			
Please can you guide me on how to add the width and height parameters to the newwindow above.

Thank you in advance;
Very Warm Regds./
radhavallabh


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Add width and Height parameter to newwindow

Post by ecartz »

https://stackoverflow.com/questions/224 ... 0_22444611 says

Code: Select all

<a href="yourpage.htm" target="_blank" onClick="window.open('yourpage.htm','pagename','resizable,height=600,width=800'); return false;">New Page</a>
So

Code: Select all

  <?php 
  $edit_orders_add_product_link = $Admin->link('edit_orders_add_product.php')->set_parameter('oID', $_GET['oID']);
  echo $Admin->button(TEXT_ADD_NEW_PRODUCT,'', 'btn-light', $edit_orders_add_product_link, ['newwindow' => true, 'onclick' => "window.open('$edit_orders_add_product_link','" . TEXT_ADD_NEW_PRODUCT . "','resizable,height=600,width=800'); return false;"]); ?>
Note: I can't promise the code to open a new window does exactly what you want, but that's how to make that particular example work in the context of an Admin button.
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: Add width and Height parameter to newwindow

Post by radhavallabh »

ecartz wrote: Fri Feb 18, 2022 7:33 am https://stackoverflow.com/questions/224 ... 0_22444611 says

Code: Select all

<a href="yourpage.htm" target="_blank" onClick="window.open('yourpage.htm','pagename','resizable,height=600,width=800'); return false;">New Page</a>
So

Code: Select all

  <?php 
  $edit_orders_add_product_link = $Admin->link('edit_orders_add_product.php')->set_parameter('oID', $_GET['oID']);
  echo $Admin->button(TEXT_ADD_NEW_PRODUCT,'', 'btn-light', $edit_orders_add_product_link, ['newwindow' => true, 'onclick' => "window.open('$edit_orders_add_product_link','" . TEXT_ADD_NEW_PRODUCT . "','resizable,height=600,width=800'); return false;"]); ?>
Note: I can't promise the code to open a new window does exactly what you want, but that's how to make that particular example work in the context of an Admin button.
Thank you so much for the explanation and code update dear!! It works perfectly :)
Thank you so much again!!!
Very warm Regds./
radhavallabh


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