Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

To all Javascript pros !!!
I urgently need a Javascript that opens a popup with a size of 400 wide and 600 high with this link:

tep_href_link('product_info.php', 'products_id=' . $printlist['products_id'])

 You always have to pass the products_id. Can you help me there ?

Link to comment
Share on other sites

Hello Peter,

If you are using the BS Community version you do not need javascript. You can use the Bootstrap built in Modal Popup:

https://getbootstrap.com/docs/4.0/components/modal/

This link is for BS4 but it's also available for BS3

OK it uses also javascript buit can be triggered with simple css/html code.

Link to comment
Share on other sites

Hello Rainer,

Thanks for your tip but I do not get it over the modal an external php page to open.
to understand it better.
I have rebuilt the product_info.php so that only the product name attribute and the purchase button appear. Now I would like that if the customer of the products_listing.php clicks on an article the new window rises where he can select the appropriate attributes and then puts the product in the basket. Opening a new window with javascript seemed easier to me.
I would be very grateful for your help.

Link to comment
Share on other sites

No matter what I try I do not get the products_id passed.

A new window with a defined size to open with javascript is not a problem but the entire link with the products_id I did not succeed.
Can anyone help me?

Link to comment
Share on other sites

pm the full code you are using and in which page you are trying to do this. Also which version are you using? as some have modular product info page others do not. Or you could just down load one of the many add-on's for product_info page and just look at the code in them.

 

Link to comment
Share on other sites

So, if it's so easy to open a popup in the size of 400 x 600 then you could post the solution here, right? here is the variable which has to be opened at the window.

$open_popup = tep_draw_button(BUTTON_TEXT_PRINTLIST_INFO, 'fab fa-product-hunt', tep_href_link('product_popup.php', 'products_id=' . $printlist['products_id']), null, null, 'btn-reviews btn-xs');

Link to comment
Share on other sites

Make sure to include the variable which holds the product id in the globals list of your module. In your case it should be $printlist.

Link to comment
Share on other sites

I have no idea how to realize my popup. I'm sorry.
Here I post the file with the product list. Look at it there is also marked from where the popup should be opened.
I am very grateful for any help but slowly I give up. try to solve it for several months again and again but I can not get it.

 

<?php
  require('includes/application_top.php');
  require('includes/languages/' . $language . '/printlist.php');
  $breadcrumb->add(NAVBAR_TITLE, tep_href_link('printlist.php'));
$print = '<a href="' . tep_href_link('printlist.php') . '"  class="btn-success btn-sm" role="button" target="_blank">' . IMAGE_BUTTON_PAGE_PRINTABLE . '</a>';
?>

<?php require('includes/template_top.php');?>

<div class="col-sm-12 thumbnail equal-height">

<div class="pull-right pls_prodboxContainer">
<?php echo $print; ?>
</div>
<div class="clearfix"></div>
<?php

$categories_name = '';
$printlist_query = tep_db_query("
                   select c.categories_id, cd.categories_id, cd.categories_name,
                   p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_tax_class_id, p.products_price, p.products_baseprice, 
                   pd.products_name, pd.products_description, 
                   m.manufacturers_id, m.manufacturers_name from 
                   products p left join manufacturers m on m.manufacturers_id = p.manufacturers_id, 
                   products_description pd, 
                   categories c,
                   categories_description cd, 
                   products_to_categories pc where 
                   p.products_id = pd.products_id and 
                   p.products_id = pc.products_id and 
                   p.products_status = 1 and 
                   pc.categories_id = cd.categories_id and 
                   cd.categories_id = c.categories_id and c.categories_status = 1 and
                   cd.language_id = '" . (int)$languages_id . "' and 
                   pd.language_id = '" . (int)$languages_id . "'" . " order by cd.categories_id, pd.products_name ASC");
while ($printlist = tep_db_fetch_array($printlist_query)) {
if($categories_name != $printlist['categories_name']) {
?>

<div class="col-sm-12 alert alert-success" role="alert">
<a href="<?php echo tep_href_link('index.php', 'cPath=' . $printlist['categories_id']); ?>"><?php echo $printlist['categories_name']; ?></a>&nbsp;<i class="fa fa-level-down" style="font-size:20px;color:red;"></i>
<div class="pull-right">
<?php 
if (SHOW_BUTTON_ASK_AND_BUY == 'true') {}else{
if (tep_has_product_attributes($printlist['products_id'])) { 
echo ' <button class="btn-reviews btn-xs"><i class="fab fa-product-hunt"></i>&nbsp;' . BUTTON_TEXT_PRINTLIST_INFO . '</button> ' . INFOTEXT_PRINTLIST_INFO;
}}?>
</div><div class="clearfix"></div>
</div>
<?php }?>
<?php
// PLS Taxinfo, Shippinginfo, Baseprice start
$pls_sc_taxinfo = ( DISPLAY_TAX_INFO == 'true' ) ? ( DISPLAY_PRICE_WITH_TAX == 'true' ) ? '<span class="pls_taxInfomodules">&nbsp;'. sprintf(TEXT_SC_INCL_VAT, tep_get_tax_rate($printlist['products_tax_class_id']).'%') . '</span>' : '<span class="pls_taxInfomodules">&nbsp;' . TEXT_EXCL_VAT . '</span>' : '';
$pls_shipping_info = ( SHOW_SHIPPING_COST == 'true' ) ?  '&nbsp;<span class="pls_Shippingtext" align="center">' . TEXT_PRINTLIST_SHIPPING_TITLE . '</span>' : '';
$pls_baseprice = '<span class="pls_basePrice">' . '&nbsp;' . $printlist['products_baseprice'] . '</span>';
// PLS Taxinfo, Shippinginfo, Baseprice ende
?>

<!-- prodcol start -->
<div class="col-sm-6"><div class="pls_PB10DRK pls_BgrYel">

<!-- inh prodnam start -->
<div class="col-sm-12">
<?php 
//////// Produktname start
  echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $printlist['products_id']) . '">' . '<strong>' . $printlist['products_name'] . '</strong></a>'; 
//////// Produktname ende
?>
<!-- item in cart + attrib start -->
<div class="pull-right">
<?php 
// Item in cart start
if ( SHOW_ITEM_IN_CART == 'true' ) {
$products = $cart->get_products();
$in_cart = '';
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$first = current(explode("{", $products[$i]['id']));
if ($first == $printlist['products_id']) {
$in_cart = '<img src="images/icons/icon_pr_in_cart.png">&nbsp;';
}}}
// Item in cart ende
$attributes = tep_draw_button(BUTTON_TEXT_PRINTLIST_INFO, 'fab fa-product-hunt', tep_href_link('product_info.php', 'products_id=' . $printlist['products_id']), null, null, 'btn-reviews btn-xs');
$popup_attributes = tep_draw_button(BUTTON_TEXT_PRINTLIST_INFO, 'fab fa-product-hunt', tep_href_link('product_popup.php', 'products_id=' . $printlist['products_id']), null, null, 'btn-reviews btn-xs');
$info_attributes = tep_draw_button('', 'fab fa-product-hunt', tep_href_link('product_info.php', 'products_id=' . $printlist['products_id']), null, null, 'btn-reviews btn-xs');
$info_attributes_buy = tep_draw_button('', 'fa fa-shopping-cart', tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . (int)$printlist['products_id']), NULL, NULL, 'btn-success btn-xs') . '&nbsp;' . $info_attributes;
?>
<?php echo $in_cart;?>

<?php 
if (SHOW_BUTTON_ASK_AND_BUY == 'true') { //ask
echo $attributes;
}else{ // ask
if (tep_has_product_attributes($printlist['products_id'])) {?>

##################################
***********************************

HERE THE LINK MUST OPEN TO OPEN THE POPUP

**********************************
##################################





<?php
}else{ 
if (MODULE_CONTENT_CUSTOMER_INDEX_INFO_BUTTON_BUY == 'True' && SHOW_BUTTON_BUY_NOW == 'true') {
echo $info_attributes_buy;
}else{ 
echo $attributes;}
}
} // ask
?>

</div>
<!-- item in cart + attrib ende -->
</div>
<!-- inh prodnam ende -->

<!-- inh prodpreis start -->
<div class="col-sm-12">
<?php
if ($new_price = tep_get_products_special_price($printlist['products_id'])) {
// eresparnis start
$priceold = $currencies->display_price($printlist['products_price'], tep_get_tax_rate($printlist['products_tax_class_id']));
$difference = $currencies->display_price($printlist['products_price'] - $new_price, tep_get_tax_rate($printlist['products_tax_class_id']));
$savings = round(($printlist['products_price'] - $new_price)/$printlist['products_price'],2)*100;
//$savings = number_format(($product_info['products_price'] - $new_price)/$product_info['products_price']*100,2,',',''); //genau berechnen
$pls_saving_info = ( SHOW_SAVING_TEXT == 'true' ) ?  '&nbsp;<span class="pls_pricesavingstext">' . TEXT_PRICE_SAVINGS . '</span><span class="pls_pricesavings">' . $difference . ' (-' . $savings . '%)</span>' : '';
// eresparnis ende
?>

<?php
	echo '<td class="smallText"><span style="color: #ff0000;"><del>' . $currencies->display_price($printlist['products_price'], tep_get_tax_rate($printlist['products_tax_class_id'])) . '</del></span> ' . $currencies->display_price($new_price, tep_get_tax_rate($printlist['products_tax_class_id'])) . ' ' . $pls_baseprice . $pls_saving_info . ' ' . $pls_sc_taxinfo . $pls_shipping_info . '</td>';
  } else {
	echo '<td class="smallText">' . $currencies->display_price($printlist['products_price'], tep_get_tax_rate($printlist['products_tax_class_id'])) . $pls_baseprice . $pls_sc_taxinfo . $pls_shipping_info . '</td>';
  }
?>
</div>
<!-- inh prodpreis ende -->

<div class="clearfix"></div>

</div></div>
<!-- prodcol ende -->


<?php $categories_name = $printlist['categories_name']; }?>
<div class="clearfix"></div>

<div class="pull-right pls_prodboxContainer">
<?php echo $print; ?>
</div>
<div class="clearfix"></div>

</div>

<?php require('includes/template_bottom.php');?>

<?php require('includes/application_bottom.php');?>

 

Link to comment
Share on other sites

3 hours ago, YePix said:

'products_id=' . $printlist['products_id']

You've confirmed that you do have an associative array $printlist, and it has an element named products_id? You didn't mean to use a variable $products_id instead of that string, for the element name, did you?

Link to comment
Share on other sites

So far I have it now,
that everything is handed down to the right products_id The window now opens with the same products_id.
Does anyone have a good tip for me now?
<script type="text/javascript">
    function openPopup() {
        winx0 = (window.screenLeft != undefined ? window.screenLeft : window.screenX) + 50;
        window.open('<?php echo tep_href_link('product_popup.php', 'products_id=' . $printlist['products_id']); ?>', 'openPopup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=300,height=650,screenX='+ winx0 + ',screenY=150,top=150,left=' + winx0);
    }
</script>
<?php 
    $params = array(
        'type'      => 'button',
        'newwindow' => true,
        'params'    => 'onclick="openPopup();return false;"'
    );
        echo tep_draw_button(BUTTON_TEXT_PRINTLIST_INFO, 'lightbulb', tep_href_link('product_popup.php', 'products_id=' . $printlist['products_id']), null, $params);
?>

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...